The idea
Key formulas
Edges in a tree
Binary tree
Depth-first traversal order
Loading lessons…
Just a moment, getting everything ready. The first load can take up to a minute.
Discrete maths
A tree is a connected graph without cycles; roots, leaves, and traversal orders organize its structure.
A tree is a connected, acyclic graph. A rooted tree designates one node as its root; every other node has one parent. A binary tree has at most two children per node. Preorder visits node, left subtree, right subtree; inorder visits left, node, right; postorder visits left, right, node.