Preorder traversal is where a node is visited before its descendants.

  • Parents always come before their children.
  • Running time for a tree with nodes is .
def preOrder(T, v):
	visit(v)
	for each child w of v in T:
		preOrder(T, w)