Tree Traversal Intro

The process of visiting each node in a tree data structure exactly once. Traversals are classified on which order the nodes are visited.

The order of the numbers doesn’t need to be like a Binary search tree. It can be all jumbled and still be a tree graph in which it is not order lower from the left and higher to the right.

There are many ways of traversing a tree.

There is Breadth first search which will start from the root going down to each node until the last node that is in the bottom. It should go across the siblings. For example.

And Depth first search which goes down the entire branch first then goes up again to go to the next brach while going through all the nodes. Like the phote shown above.