Min heap can be used to implement selection sort.

Category: QuestionsMin heap can be used to implement selection sort.
Editor">Editor Staff asked 1 month ago

Min heap can be used to implement selection sort.
 
(a) True
 
(b) False
 
This key question is from Heap topic in chapter Heap of Data Structures & Algorithms I
 
This question was posed to me during an internship interview.

1 Answers
Editor">Editor Staff answered 1 month ago

Right option is (a) True
 
To explain: In min heap, the insertion and deletion operation takes O(logn) time. Therefore, a selection sort with n insertions and n deletions can be implemented using a min heap in O(nlogn) operations.