Complexity Analysis MCQ
Complexity Analysis MCQ
Complexity Analysis MCQ
Q1 Time Complexity Of Kruskals Algorithm(Here E is the number of edges
and V are the number of vertices) are (more than one correct)
a) O(ElogV)
b) O(Elog√E)
c) O((V^2)log(E^2) + Elog(V^2)) d)
O(ElogE + Elog(V^2))
Q2 In which of the following time complexities you can find the minimum
element in a stack after each pop() operation (Don’t Consider Space
Complexity)
(Here n is the size of stack)
A) O(n)
B) O(√n)
C) O(1)
D) O(logn)
Q3 What is the time complexity of a non dynamic programming and
recursive implementation of fibonacci number
A) 2^n
B) n
C) Logn
D) None of above
Q4 In what best time complexity we can find the nth fibonacci number?
A) 2^n
B) N
C) Logn
D) None
Q5 What is the space complexity of mergesort of array?
A) O(nlogn)
B) O(logn)
C) O(n)
D) O(2^n)
Q6 You have to implement a new kind of array which is similar to
traditional array i.e. you can access elements by specifying their index,
traverse it and all the other features of array. The extra feature that you
have to add is that this new array must increase its size and never gives
overflow error. You have to implement this array using the traditional inbuilt
array and you cannot preassume a very big size array as to conserve the
space. In what best complexity you can perform the insert operation.
A) O(1)
B) O(logn)
C) O(n)
D) O(n^2)
Q7 The usual selection sort has a running time of O(n^2). It uses linear
search to identify the position where an element is to be inserted. What will
be the average time complexity of we use binary search in place of it?
A) n
B) nlogn
C)n
D) n^2
Q8 You have to find square root of a number(Only the integral part). In
what best time complexity we can achieve this?
A) n
B) √n
C) logn
D)1
Q9 In what best time complexity one can find 2 to the power n?
A) n
B) 1
C) logn
D) √n
Q10 Which of the following asymptotic notation is the worst among all?
A) 2^O(n)
B) O(n+2378)
C) n^O(1)
D) O(n^3)
Q11 When would you use a bubble sort as opposed to an insertion sort?
A) Only if the amount of data was very small, so that speed was less
important than the simplicity of the algorithm.(correct)
B) Bubble sort always beat insertion sort
C) Both have same time complexity
D) All of above
Q12 How many elements do we eliminate each time for the Analysis of
Selection Algorithm?
A) (n / 2)+n Elements
B) n / 2 Elements
C) n / 4 Elements
D) 2n Elements
Q13 Suppose T(n) = 2T(n/2) + n, T[0]=T[1]=1. Which of the following is
true
A) T(n)=O(n^2)
B) T(n)=ø(nlogn)
C) T(n)=Ω(n^2)
D) T(n)=O(nlogn)