View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 2.12 KB File ID: #34218 Version: 1.0



Hanan Kavitz (view profile)


heap data type

| Watch this File

File Information

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

Required Products MATLAB
MATLAB release MATLAB 7.13 (R2011b)
Other requirements should work fine on any Matlab release starting from 2008
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
07 May 2014 Yasha

Yasha (view profile)

The description should mention that this heap only sorts keys and does not support key-value pairs.

Comment only
24 Dec 2011 Hanan Kavitz

Hanan Kavitz (view profile)

Derec Hello,
Heap is a very usefull data type used in many algorithms primarily due to the fact that you can get maximum number in the heap with runtime of O(1) and extracting maximum(or minimum) with runtime of O(logn).
What I meant is that sorting is done, in this case, much slower than just using sort(A).
For any other operation with Heap this code is good.

Comment only
22 Dec 2011 Derek O'Connor

What is the point of this submission, if, as you say in your preamble to Heap, "very, very slow... not to be used for sorting arrays!!! "

Comment only

Contact us