A sorted binary tree

Depth-first
  • Preorder traversal sequence: F, B, A, D, C, E, G, I, H (root, left, right)
  • Inorder traversal sequence: A, B, C, D, E, F, G, H, I (left, root, right); note how this produces a sorted sequence
  • Postorder traversal sequence: A, C, E, D, B, H, I, G, F (left, right, root)
Breadth-first
  • Level-order traversal sequence: F, B, G, A, D, I, C, E, H
Advertisements