Data Structures19 sections · 729 units
Open in Course

Intro

Beyond basic trees

You've learned segment trees, Fenwick trees, and BSTs. But what happens when you need to answer queries on tree paths? Or find distances between nodes efficiently?

Standard techniques fall short on tree structures. You can't use array decomposition directly because trees aren't linear.

In this section, you'll learn three powerful techniques: Heavy-Light Decomposition (HLD) for path queries, Centroid Decomposition for divide-and-conquer on trees, and Treaps for balanced BSTs with order statistics. These are the tools that solve the hardest tree problems.