Sorting Algorithms++ Ep07: Heaps (Extra Notes)

preview_player
Показать описание
I fix some mistakes, and cover some things about heaps and heapsort that we didn't have time to cover previously!

= Intro Track Adapted From =
Licensed under Creative Commons: By Attribution 3.0
ISRC: USUAN1100879

= 0612 TV =
0612 TV is your one stop for general geekery! Learn about a variety of technology-related subjects, including Photography, General Computing, Audio/Video Production and Image Manipulation! Enjoy your stay, and don't hesitate to drop me a comment or a personal message to my inbox =) If you like my work, don't forget to subscribe!

Рекомендации по теме
Комментарии
Автор

If you use parent*2+1 for left child and parent*2+2 for right child then you can use the array at index 0. Then use (child-1)/2 to find its parent.

stevencassalger
Автор

Hi,

You make great videos!

I am currently taking a Java course at my university and Java is a language that starts with the index # 0. To find the right or left child we actually have the same equation but we add 1. In other words Index for root 0, index for left child 2*index+1 and index for right child is 2*index+2.

kevindaberius
Автор

Correcting your statements is one of the strength of yours. Very few people do it... Thanks again :)

PratikShah
Автор

Hi lcc0612. I love your videos, thank you so much for posting them!!! A question regarding the order of siftdowns from right to left and bottom to top at 7:19. If you replace the 3 at the root with a large number, say 100, doing the siftdowns from right to left and bottom to top will not finish the job in one pass (the bottom right part will be messed up with the switch between 1 and 100). Did you mean that we do the siftdowns for as many passes as needed so that eventually the heap is built correctly? 

mindormood
Автор

Great video! Would a heapsort with minimum heap be possible by placing items to the left?

davidroloham
welcome to shbcf.ru