Updated 15 Dec 2011
Implements heap data type.
h- an array in which the data is stored
heapSize- the size of the heap
Heap- constructor for the Heap class, acepts numeric arrays as an input.
heapSort- method for performing sorting, runtime O(nlogn),although, very, very slow... not to be used for sorting arrays!!!
heapMaximum- returns maximum in the heap heapExtractMax- extracts maximum value from the heap
heapIncreaseKey- increses the key in the postion i
maxKeyInsert- inserts a key in the heap
made by Hanan Kavitz
free for distribution
Hanan Kavitz (2023). Heap (https://www.mathworks.com/matlabcentral/fileexchange/34218-heap), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.