1.

What will be the output if quickselect algorithm is applied to the array arr={1,5,4,3,7} with k given as 4?(a) 1(b) 3(c) 4(d) 5I had been asked this question in an international level competition.This intriguing question comes from Miscellaneous in section Miscellaneous of Data Structures & Algorithms II

Answer»

Correct choice is (d) 5

The EXPLANATION is: QUICKSELECT algorithm finds the kth smallest element from the GIVEN list. So as here the given value of k is 4 so we need to FIND the fourth smallest element which is 5 in the given ARRAY.



Discussion

No Comment Found

Related InterviewSolutions