Formally, a tree is said to be balanced if the difference between the depths of any node's left tree and right tree is no greater than 1.
Thus a 'balanced' tree 'looks full', without any apparent chunks missing or any branches that end much earlier than other branches.
Interview coming up?
Get the free 7-day email crash course. You'll learn how to think algorithmically, so you can break down tricky coding interview questions.
No prior computer science training necessary—we'll get you up to speed quickly, skipping all the overly academic stuff.
No spam. One-click unsubscribe whenever.
You're in! Head over to your email inbox right now to read day one!