Graph Theory37 sections · 1633 units
Open in Course

Variations of the Technique

(Beyond basic merging)

You can use small-to-large with other data structures beyond sets and maps. Merge multisets to track duplicates with counts. You can merge priority queues for median tracking in subtrees. You can even merge segment trees or other advanced structures.

The core idea (merge small into large) applies anywhere you are combining containers. The O(nlogn)O(n \log n) guarantee holds as long as you respect the size ordering.