Binary Heap Structure
I was studying for the CS1 final and wrote a program to understand binary heap more. So I want to share it. I didn’t fully test it, and if you enter more than 2 digit numbers, the visualization of heap messes up. So play with only 2 digit numbers. Also, I am using -1000 to indicate that spot is not filled yet, so it doesn’t work right if you enter -1000. Alternative for this is making another 1D array to save if that index is filled in or not. Anyway, you can start from my code and change whatever you want!
I will put some code here, and entire code on Github gist.
Enjoy!!