Why is heap sort preferred over merge sort for introsort implementation?

Nguyễn Pháp

New member
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 understand
 
Answer: b
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.
 

Tìm kiếm

Back
Top