Archives
-
Binary Tree : Print Path From Root To Leaves & Max Depth
Problem : Given the following binary tree, print all the paths from root node to all the leave nodes.
-
Binary Tree : Level Order Traversal
In a binary tree, node level is defined as the number of nodes which are in between the node in context & the root node. If we consider root node is at level 0, then immediate child nodes of root are at level 1 and the subsequent child nodes are level 2 and so on. Thus level order traversal of a binary tre involves processing nodes on the basis of their levels i.e. level 0 nodes are to be processed before nodes at level 1 which are to be processed before nodes which are at level 2 etc. The screenshot below shows a tree and its corresponding level order traversal :