1.

Which one of the following sorting algorithm is best suited to sort an array of 1 million elements?(a) Bubble sort(b) Insertion sort(c) Merge sort(d) Quick sortThe question was asked in quiz.This intriguing question comes from Quicksort topic in section Sorting of Data Structures & Algorithms II

Answer»

Right choice is (d) Quick sort

For explanation: The Quick sort is best suited to sort the ARRAY of 1 MILLION elements. The practical implementations of Quick sort use randomised version. In practice randomised Quick sort algorithms rarely shows worst CASE behaviour and is almost always O(nlogn). And Quick sort requires little additional space and exhibits good CACHE LOCALITY.



Discussion

No Comment Found

Related InterviewSolutions