...

/

Breadth-first Traversal

Breadth-first Traversal

In breadth-first traversal, we traverse the binary search tree from left to right. (Reading time: under 5 minutes)

With breadth-first traversal, we first traverse through one level of children nodes, then through one level of grandchildren nodes, then through one level of grand-grandchildren nodes, etc. In the above tree, the numbers show the sequence in which the nodes will be traversed, not the data! With breadth-first search, we can’t use a stack like we could with depth-first search: when we go from node 1 to node ...

Access this course and 1400+ top-rated courses and projects.