Build Max Heap

preview_player
Показать описание
Take an array of unordered numbers and convert it into a max heap
Рекомендации по теме
Комментарии
Автор

Thanks a lot, Hunter! I was wondering how to put the numbers into a heap from an array, and now I know.

duskshadow
Автор

2:50 Isn't 2 actually the right child of 1? Doesn't the rule of floor(i/2) assume that indexes start at 1?

Batu
Автор

To delete the root, just do this:
1. save the old root
2. put the last element in the root slot and decrement the heapsize
3. call the heapify function on the root slot

hunterrjohnson
Автор

Weird...video is not loading. All the others are though. FYI ~Jessica

iceysparkz