Walk this tree in preorder order: the node first, then its left subtree, then its right.
A binary search tree with 7 nodes. Walking it in preorder order, which visits the node first, then its left subtree, then its right.
50 is the root, and preorder writes a node down before going anywhere.
Visiting 50, number 1 of 7. The order so far is 50.
30 is reached, and preorder writes it down straight away.
Visiting 30, number 2 of 7. The order so far is 50, 30.
20 is a leaf, so there is nothing below it to do first.
Visiting 20, number 3 of 7. The order so far is 50, 30, 20.
40 is a leaf, so there is nothing below it to do first.
Visiting 40, number 4 of 7. The order so far is 50, 30, 20, 40.
70 is reached, and preorder writes it down straight away.
Visiting 70, number 5 of 7. The order so far is 50, 30, 20, 40, 70.
60 is a leaf, so there is nothing below it to do first.
Visiting 60, number 6 of 7. The order so far is 50, 30, 20, 40, 70, 60.
80 is a leaf, so there is nothing below it to do first. That is the last one.
Visiting 80, number 7 of 7. The order so far is 50, 30, 20, 40, 70, 60, 80.
The preorder walk is 50, 30, 20, 40, 70, 60, 80.
The preorder traversal visited 50, 30, 20, 40, 70, 60, 80.