Saturday, July 11, 2015

Leacture 4: heaps and heap sort


https://www.youtube.com/watch?v=B7hVxCmfPtM

Notes: any array can be views as a heap. Meaning image it as a balanced binary tree. With left(i)=2i, right(i)=2i+1, parent(i)=i/2 etc.

max heap means the heap also has a "max" property. Root is bigger than its children.

ma_heapify(A, i), bottom up, recursive. All the leap nodes trivially satisfy the requirement.

No comments: