Skip to content
Pop (Sift-Down)
step 1/5

Reading — step 1 of 5

Read

~1 min readOperations

Pop (Sift-Down)

Remove the min (root): replace with the last element, shrink, then sift down.

python

At each level, find the smaller of left/right child. If it's smaller than the current, swap and recurse. Bounded by tree height: O(log n).

Symmetric to sift-up, but we go down. Together with push, gives complete priority queue API.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…