What is a tree and a binary search tree (BST)?
Tree
A connected acyclic graph: one root, every node has children, leaf nodes have none. iOS examples: the view hierarchy, the DOM, the file system, an AST, NavigationStack/UINavigationController as a path through a tree of screens. In a binary tree a node has at most two children.
Traversals: depth-first (DFS: pre-order, in-order, post-order — recursion or an explicit stack) and breadth-first (BFS — a queue, level by level).
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep