There are two different questions hiding in "when do I use a tree?". One is about designing a program: when should your data live in a tree? The other is about interviews: the tree is given — which way should you walk it? This lesson answers both.
Members only · free account
The rest of this lesson, with 3 more sections, 1 drawing, a dry-run simulator and code in JavaScript, Python, Java and C++, opens with a free account.
Not ready yet? The Arrays course is free to read, no account needed.
In the rest of this lesson