Skip to main content

Questions tagged [heap-sort]

Heapsort is an efficient comparison-based sorting algorithm that divides an input into a sorted and an unsorted part and iteratively shrinks the unsorted part by extracting the largest element and moving that to the sorted part. Run time is O(n log n).

Filter by
Sorted by
Tagged with
5 votes
3 answers

Local heapsort in C++

Suppose we need to sort a sequence and we know that every sequence component is within \$d\$ steps from its correct position. In such a case we can use a local heapsort: we take \$d\$ as an argument ...
coderodde's user avatar
  • 28.7k
3 votes
2 answers

Min&Max Heap implementation in .NET

Overview I was doing some performance optimization patterns when I stumbled upon PriorityQueue and I implemented for that reason ...
kuskmen's user avatar
  • 413