PRUTOR FINAL QUIZ

Q:1. In a binary search algorithm, Which is the worst case scenario:-

1.
2.
3.
4.

Q:2. Which statement is correct in case of tower of hanoi ?

1.
2.
3.
4.

Q:3. How many swaps will be performed in selection sort in worst case :-

1.
2.
3.
4.

Q:4. Which of the following is true for binary search algorithm :-

1.
2.
3.
4.

Q:5. Which of the following statement is true for recursion ?

1.
2.
3.
4.

ANSWERS

Ans 1:- O(logn)

 In binary search, we eliminate half of the possible entries. So, worst case time complexity of binary search is logarithmic.

Ans 2 Only one disk can move at a time.

Rules for tower of hanoi is only one disk can move at a time.

Ans 3 n-1

selection sort gives the minimum number of swaps to sort an array.

Ans 4 Array can be sorted order

Binary Search works by assuming the middle of the array contains the middle value in the array.

Ans 5 Absence of base condition can cause infinte loop

needs a condition to terminate

Post a Comment

0 Comments