Min heap can be used to implement selection sort.

Category: QuestionsMin heap can be used to implement selection sort.
Editor">Editor Staff asked 5 months 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 5 months 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.


Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40701