Binary Tree
PronunciationBY-nuh-ree TREE
Definition
A binary tree is a structure of nodes where each node has at most two children, called left and right, starting from a single root node.
Where you hear it
In algorithms courses and interviews, expression parsers, file-system-like structures and heaps.
Examples
Each node holds a value and two child pointers.
Find the depth of a binary tree with a recursive function.
An expression tree is a binary tree whose leaves are numbers.
Common mistake
Assuming every binary tree is balanced. A degenerate tree can look like a linked list.
Don't confuse with
A binary search tree, a binary tree with an ordering rule that makes searching fast.
Say it at work
- In a meeting or chat
Walk the tree in-order.
- In an email or ticket
What's the height of this tree?
Keep exploring
More in Programming Fundamentals