InterviewSolution
Saved Bookmarks
| 1. |
Why is heap sort preferred over merge sort for introsort implementation?(a) Because heap sort is faster(b) Because heap sort requires less space(c) Because heap sort is easy to implement(d) Because heap sort is easy to understandI had been asked this question by my college director while I was bunking the class.Query is from Sorting in division Sorting of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (b) Because heap sort REQUIRES less space Best explanation: Both heap sort and merge sort have the same time complexity. But heap sort is an in-place sorting ALGORITHM whereas merge sort requires O(n) AUXILIARY space which makes heap sort a more preferable option. |
|