00:01
So we have this max heap represented with an array, and we can draw it out like this.
00:08
So where we have 25, 14, 16, 13, 10, 8, and 12, and we want to do two remove max operations.
00:20
So the way we do those operations is by swapping the last element of the heap, which is the one with the large index.
00:29
So in this case, it would be 12.
00:32
And we want to swap it with the maximum value, which is the root 25.
00:37
And then we're going to do that, and then heatify the rest of the heap to balance it back to the normal.
00:44
So let's go ahead and do our first delete operation.
00:46
So we're going to swap the last element for the root.
00:49
So we're going to swap 12 and 25.
00:52
And now that we've swapped them, we can delete 25.
00:56
I'm going to represent that as a period.
00:58
And so now that we have this, we notice that 12 is on top of 14 and 16...