What is heap sort?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is heap sort??

Real life application of heap sort Plz...... Explain it in easy way🙂😊

27th Nov 2017, 6:16 PM
Chetana Rajendra Sonawane
Chetana Rajendra Sonawane - avatar
2 Answers
+ 2
It's a sorting algorithm, that means you have a list of unsorted things and it comes out sorted. It does so by turning the list into a heap, which is a binary tree (if you don't know what that is, look it up) with the added rule that each node in the tree must be smaller than it's parent. So the data is being "half-sorted" by being turned into a heap, and heaps are capable of being sorted very quickly. It has tons of real-life applications, because - it is dang fast - it is slower than quicksort, but more consistent (quicksort can be slow on certain inputs) If you happen to already have a heap structure, heapsort of course always wins out.
27th Nov 2017, 6:34 PM
Schindlabua
Schindlabua - avatar
+ 2
Thank you mr Schindlabua.... for explain heap sort
27th Nov 2017, 7:47 PM
Chetana Rajendra Sonawane
Chetana Rajendra Sonawane - avatar