Skip to main content

Interview

Binary Tree Traversals in Java: Inorder, Preorder, Postorder and Level Order (Recursive and Iterative)

Binary tree traversal in Java on one numbered nine-node tree: recursive and iterative inorder, preorder and postorder with stack dry-run tables, one-stack postorder, Morris traversal, level order and zigzag with a queue, height, an O(n) versus O(n squared) diameter comparison by counted visits, a real StackOverflowError on a one-million-node skewed tree, and exam questions with answers.