0% found this document useful (0 votes)
80 views

Complexity Analysis MCQ

The document contains 13 multiple choice questions about time and space complexity analysis of various algorithms like Kruskal's algorithm, finding minimum element in a stack, Fibonacci numbers, mergesort, binary search, selection sort, and recursive functions. It asks about the best asymptotic time complexities for operations like finding the nth Fibonacci number, calculating square roots, or raising 2 to the power of n. It also contains questions about asymptotic notations and analyzing recursive functions using the Master Theorem.

Uploaded by

Dustin Martin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Complexity Analysis MCQ

The document contains 13 multiple choice questions about time and space complexity analysis of various algorithms like Kruskal's algorithm, finding minimum element in a stack, Fibonacci numbers, mergesort, binary search, selection sort, and recursive functions. It asks about the best asymptotic time complexities for operations like finding the nth Fibonacci number, calculating square roots, or raising 2 to the power of n. It also contains questions about asymptotic notations and analyzing recursive functions using the Master Theorem.

Uploaded by

Dustin Martin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Complexity Analysis MCQ

Q-1 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))
Ans-a,b,d

Q-2 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) (correct)
D) O(logn)

Q-3 What is the time complexity of a non dynamic programming and


recursive implementation of fibonacci number
A) 2^n(coorect)
B) n
C) Logn
D) None of above
Q-4 In what best time complexity we can find the nth fibonacci number?
A) 2^n
B) N
C) Logn (correct)
D) None
Q-5 What is the space complexity of mergesort of array?
A) O(nlogn)
B) O(logn)
C) O(n) (correct)
D) O(2^n)
Q-6 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)
Q-7 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(correct)
Q-8 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 (correct)
D) 1
Q-9 In what best time complexity one can find 2 to the power n?
A) n
B) 1
C) logn (correct)
D) √n
Q-10 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)(correct)
Q-11 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
Q-12 How many elements do we eliminate each time for the Analysis of
Selection Algorithm?
A) (n / 2)+n Elements
B) n / 2 Elements(correct)
C) n / 4 Elements
D) 2n Elements
Q-13 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)(correct)
D) T(n)=O(nlogn)

You might also like