Skip to content

1.8 Basic Tree Traversals and Operations

General tree traversal patterns including DFS, BFS, level-order, zigzag, boundary traversal, LCA, serialization, and iterative approaches.

indexslugname
1tree-traversalTree Traversal
2dfsDepth First Search
3bfsBreadth First Search
4preorderPreorder
5inorderInorder
6postorderPostorder
7level-orderLevel Order
8zigzag-traversalZigzag Traversal
9vertical-orderVertical Order
10boundary-traversalBoundary Traversal
11tree-heightHeight
12tree-sizeSize
13tree-diameterDiameter
14tree-balanceBalance
15tree-lcaLowest Common Ancestor
16tree-path-sumPath Sum
17tree-flattenFlatten
18tree-mirrorMirror
19tree-symmetricSymmetric Check
20tree-serializeSerialize
21tree-deserializeDeserialize
22tree-prunePrune
23tree-mergeMerge
24tree-copyCopy
25tree-iteratorIterator
26tree-recursiveRecursive Pattern
27tree-iterativeIterative Pattern
28tree-threadedThreaded Tree
29tree-naryN-ary Tree
30tree-invariant-checkInvariant Check