Red-Black Trees
The need for an efficient self-balancing tree is precisely why computer scientists developed the red-black tree. The tree bears this name because its nodes are colored either red or black, for reasons we’ll look at shortly. Using brilliant algorithms, red-black trees keep themselves balanced and do so without taking too much extra time.
While these trees are clever and fast, they’re complex and involve many details. Most presentations of red-black trees plow straight into these details, getting into the weeds right away. This usually leaves people terribly confused.
As such, I’d like to start not with the what, but rather with the why and the how. Like peeling an onion, we’ll unpack this topic one layer at a time. This should ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access