Complexity Analysis Station [5]

Complexity Analysis Station [5]

University

5 Qs

quiz-placeholder

Similar activities

Monday Class Quiz 3/22

Monday Class Quiz 3/22

University

9 Qs

Intro Quiz

Intro Quiz

University

10 Qs

Complexity Analysis Station [3]

Complexity Analysis Station [3]

University

6 Qs

Complexity Analysis Station [1]

Complexity Analysis Station [1]

University

7 Qs

Revisando a Aula 4 Estrutura de Dados

Revisando a Aula 4 Estrutura de Dados

University

8 Qs

Tes Awal Modul 4

Tes Awal Modul 4

University

10 Qs

Complexity Analysis Station [4]

Complexity Analysis Station [4]

University

6 Qs

Kuis 3 - ASD (B)

Kuis 3 - ASD (B)

University

10 Qs

Complexity Analysis Station [5]

Complexity Analysis Station [5]

Assessment

Quiz

Computers

University

Hard

Created by

Dareen Hussein

Used 2+ times

FREE Resource

5 questions

Show all answers

1.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Media Image

What is asymptotic complexity in the following void function?

2.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Media Image

What is asymptotic complexity in the following void function?

3.

FILL IN THE BLANK QUESTION

3 mins • 1 pt

Ryan is implementing a merge sort algorithm that he heard about in computers class. However, he wasn't paying attention, and ended up implementing the merge sort in a very unusual way.

The standard merge sort takes a list, and recursively splits it in half, until there is only one element left. It then uses the idea that two sorted lists can be easily merged in O(n)time using "two pointer technique" (this step is usually called merge).

Ryan doesn't know about two pointer technique, however, so he decided to replace merge with a bubble sort! The bubble sort runs in O(n^2) time.

What is the runtime of this merge sort implementation?

4.

OPEN ENDED QUESTION

3 mins • 1 pt

Media Image

Write a function named "rotate_right" that takes as its argument an array of floating point values and an integer that tells the number of cells in the array.

The function should shift the contents of each cell one place to right, except for the last cell which should be moved into the cell with subscript 0. Thus for example if the function looks like the first table above should end like the second one

Evaluate responses using AI:

OFF

5.

OPEN ENDED QUESTION

5 mins • 1 pt

Suppose a sequence A of n numbers should already be in ascending order. Thus for the

sequence (6,2,9,5,8,7) there are 6 pairs that are out of sequence:

(6,2) , (6,5) , (9,5) , (9,8) , (9,7) , (8,7)

• Implement an algorithm to return the number of these out-of-order pairs.

Hint: An out-of-order pair (Ai,Aj) is such that: ( i < j ) AND (Ai > Aj).

• Determine T(n) = number of array element comparisons.

• What is the Big-O of this algorithm?

Evaluate responses using AI:

OFF