MCQ - Complexity Algorithms in Data Structure

11. What is the time complexity of following code:

int a = 0, i = N;
while (i > 0) {
   a += i;
   i /= 2;
}

A. O(N)
B. O(Sqrt(N))
C. O(N / 2)
D. O(log N)

View Answer


12. The complexity of Binary search algorithm is

A. O(n)
B. O(log )
C. O(n2)
D. O(n log n)

View Answer


13. The complexity of merge sort algorithm is

A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)

View Answer


14. The complexity of Bubble sort algorithm is

A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)

View Answer


15. The worst case complexity for insertion sort is

A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)

View Answer


16. The worst case complexity of quick sort is

A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)

View Answer


17. To measure Time complexity of an algorithm Big O notation is used which:

A. describes limiting behaviour of the function
B. characterises a function based on growth of function
C. upper bound on growth rate of the function
D. all of the mentioned

View Answer


18. If for an algorithm time complexity is given by O(1) then complexityof it is:

A. constant
B. polynomial
C. exponential
D. none of the mentioned

View Answer


19.If for an algorithm time complexity is given by O(log2n) then complexity will:

A. constant
B. polynomial
C. exponential
D. none of the mentioned

View Answer


20. If for an algorithm time complexity is given by O(n) then complexityof it is:

A. constant
B. linear
C. exponential
D. none of the mentioned

View Answer






Also Check :


Discussion


* You must be logged in to add comment.