1.

Which of the following algorithm takes non linear time for sorting?(a) counting sort(b) quick sort(c) bucket sort(d) radix sortThe question was posed to me in a job interview.Query is from Sorting in section Sorting of Data Structures & Algorithms II

Answer»

Right option is (b) quick sort

For explanation: Quick sort requires O(n log n) time for sorting so it TAKES non linear time for sorting whereas COUNTING sort, BUCKET sort and radix sort sorts in linear time.



Discussion

No Comment Found

Related InterviewSolutions