Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

3 Deva Sainath Reddy Maddirevula 2200033070 D2

Dashboard  My courses  DATA-22SC1202 2022-2023 EVEN SEM  CO1  3973

DATA STRUCTURES 2022-2023 EVEN SEM 3973

Started on Monday, 13 February 2023, 11:11 AM


State Finished
Completed on Monday, 13 February 2023, 11:15 AM
Time taken 3 mins 25 secs
Marks 15.0/15.0
Grade 10.0 out of 10.0 (100%)

Question 1 Correct Mark 1.0 out of 1.0

For the Quick sort algorithm, what is the time complexity of the
best/worst case?

2
a. best case: O(n log(N) ) worst case: O(n )

b. best case: O(n2), worst case: O(n log(N))

c. best case: O(n2), worst case: O(n2log(N) )


2
d. best case: O(log(N)) worst case: O(n )

e. None

Your answer is correct.

The correct answer is:


2
best case: O(n log(N) ) worst case: O(n )
Question 2 Correct Mark 1.0 out of 1.0

What is the time complexity of insertion sort in best case?

a. O(nlog2n)

b. None

c.  O(N)
2
d. O(n )

e. O(log2n)

Your answer is correct.


The correct answer is:  O(N)

Question 3 Correct Mark 1.0 out of 1.0

Quick sort running time depends on the selection of

a. sequence of values

b. pivot element

c. none of the above

d. size of array

Your answer is correct.

The correct answer is:


pivot element
Question 4 Correct Mark 1.0 out of 1.0

Which of the following algorithm does not divide the list −

a. linear search

b. binary search

c. merge sort

d. Quick sort

Your answer is correct.

The correct answer is:


linear search

Question 5 Correct Mark 1.0 out of 1.0

Worst case Time Complexity of Linear Search is?

a. O(Nlog(N))

b.  O(1)

c. O(N)

d. O(log(N))

e. None

Your answer is correct.

The correct answer is:


O(N)
Question 6 Correct Mark 1.0 out of 1.0

What is not true about insertion sort?

a. Worst case and average case performance is Ο(n2)

b. Exhibits the worst case performance when the initial array is sorted in reverse order.

c. None of the above.

d. Can be compared to the way a card player arranges his card from a card deck.

Your answer is correct.


The correct answer is:
None of the above.

Question 7 Correct Mark 1.0 out of 1.0

 Which of the following algorithm design technique is used in the


quick sort algorithm?

a. Dynamic programming

b.  Greedy method

c. Divide and conquer

d. Backtracking

Your answer is correct.

The correct answer is:


Divide and conquer
Question 8 Correct Mark 1.0 out of 1.0

Calculate the time complexity for the following code snippet?


int a = 0;

for (i = 0; i < N; i++) {

     for (j = N; j > i; j--) {

         a = a + i + j;

     }

a. O(n*logn)

b. O(N)

c. O(n*sqrt(N))

d. O(n*n)

Your answer is correct.


The correct answer is:
O(n*n)
Question 9 Correct Mark 1.0 out of 1.0

Which of the following is not a stable sorting algorithm in its typical implementation.

a. quick sort

b. merge sort

c. Insertion Sort

d. Bucket sort

Your answer is correct.


The correct answer is:
quick sort

Question 10 Correct Mark 1.0 out of 1.0

The running time T(N) is given as


T(N) = c + T(n-1) , if  n >1
        = d , if  n<=1
The order of the algorithm is

3
a.  n
n
b.  n

c. n
2
d. n

Your answer is correct.

The correct answer is:


n
Question 11 Correct Mark 1.0 out of 1.0

Consider the following sorting algorithms. I. Quicksort II. Heapsort III. Mergesort Which of them
perform in least time in the worst case?

a. II and III only

b. III only

c. I and II only

d. I II and III

Your answer is correct.


The correct answer is:
II and III only
Question 12 Correct Mark 1.0 out of 1.0

Consider an array of elements arr[5]= {5,4,3,2,1} , what are the steps of insertions done while doing
insertion sort in the array.  

a.

45321

34521
23451

12345

b. 5 4 3 1 2

54123

51234
12345

c. 4 3 2 1 5

32154

21543
15432

d. 4 5 3 2 1

23451
34521

12345

Your answer is correct.


The correct answer is:
45321
34521
23451
12345

Question 13 Correct Mark 1.0 out of 1.0

int a = 0, i = N;

while (i > 0) {

     a += i;

     i /= 2;

find the time complexity?

a. O(log n)

b. O(n*logn)

c. O(N^2)

d. None of the above

Your answer is correct.

The correct answer is:


O(log n)
Question 14 Correct Mark 1.0 out of 1.0

Analyzing of an algorithm involves

a. Validating the algorithm Only

b.  Evaluating the complexity only

c. None of these

d. Both Validating the algorithm and Evaluating the Complexity

Your answer is correct.


The correct answer is:
Both Validating the algorithm and Evaluating the Complexity

Question 15 Correct Mark 1.0 out of 1.0

The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

2 2
a. Θ(n ), Θ(n ) and Θ(n Log n)
2
b. Θ(n ), Θ(n log n) and Θ(n log n)
2
c. Θ(n log n), Θ(n log n) and Θ(n )
2 2
d. Θ(n ), Θ(n log n) and Θ(n )

Your answer is correct.


The correct answer is:
2 2
Θ(n ), Θ(n log n) and Θ(n )

◄ HOME ASSIGNMENT-I Jump to... CO-2PPTS ►

You might also like