What is a binary tree?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Data Structures & Algorithms topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
A binary tree is a hierarchical data structure where each node has at most two children, referred to as the left child and the right child. Terminology: Root — top node with no parent; Leaf — node with no children; Internal node — node with at least one child; Height — longest path from root to leaf; Depth — length of path from root to a node; Subtree — a node and all its descendants. Types: Full binary tree — every node has 0 or 2 children; Complete binary tree — all levels filled except possibly the last, filled left to right; Perfect binary tree — all internal nodes have 2 children, all leaves at same depth; Balanced binary tree — height is O(log n); Degenerate/skewed tree — every node has only one child (like a linked list, O(n) height). Properties of a perfect binary tree with height h: nodes = 2^(h+1) - 1, leaves = 2^h. Binary trees are the basis for BSTs, heaps, tries, segment trees, and expression trees.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last Data Structures & Algorithms project, I used this when...' immediately makes your answer more credible and memorable.