| Binary Tree Traversal : | ||||
Traversal of a binary tree means to visit each node in the tree exactly once. The tree traversal is used in all the applications of it.
In a linear list nodes are visited from first to last, but a tree being a non linear one we need definite rules. There are a no. of ways to traverse a tree. All of them differ only in the order in which they visit the nodes. The three main methods of traversing a tree are:
In all of them we do not require to do anything to traverse an empty tree. All the traversal methods are based on recursive functions since a binary tree is itself recursive as every child of a node in a binary tree is itself a binary tree. |
||||
| Prev | ||||