Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 46s1 days 16 hours 1 minutes 46 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 46s1 days 16 hours 1 minutes 46 seconds.

Sign in to watch this lesson
Advanced - Data Structures and Range Queries · 5:13
A randomized meldable heap is a binary tree in heap order where every operation is one merge: push merges in a single node, pop merges the root's two children, deleting a known node merges its children in its place, and melding two heaps is one merge. Merge keeps the smaller root on top, flips a fair coin to swap that root's children, and recurses into the left child; the expected path length is at most log(n + 1), and long paths are exponentially rare. That makes heap melding O(log n), which binary heaps can't do, and it powers bottom-up merging in tree problems and slope trick.