We can traverse through all the nodes of a binary tree by writing a recursive function similar to depth first traversal in a graph.
We will create a recursive function which takes a node as a parameter and then starts visiting the left child and the right child of the node. Based on the order in which the recursive function traverses each node of the binary tree, we can have different types of traversals in a tree :