You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In size_ := heap.list.Size()/2 + 1
Adjusting the code to size_ := heap.list.Size()/2 - 1 would be a more suitable approach.
We just need internal node to heapify. For Push(3, 2, 1), we just need index 0 to heapify, for Push (7, 6, 5, 4, 3, 2, 1), index 0, 1, 2 should be bubbleDown instead of index for 0 to 4.
The text was updated successfully, but these errors were encountered:
In BinaryHeap,a function called Push
In
size_ := heap.list.Size()/2 + 1
Adjusting the code to
size_ := heap.list.Size()/2 - 1
would be a more suitable approach.We just need internal node to heapify. For
Push(3, 2, 1)
, we just need index 0 to heapify, forPush (7, 6, 5, 4, 3, 2, 1)
, index 0, 1, 2 should be bubbleDown instead of index for 0 to 4.The text was updated successfully, but these errors were encountered: