Be the first user to complete this post
|
Add to List |
54. Maximum Width of a Binary Tree
Objective: Given a binary Tree, write an algorithm to find the maximum width.
Note: The maximum width of a tree is nothing but the Max(nodes at each level).
Example:
Approach:
Do level order traversal and in recursive calls count the number of nodes at each level and keep track of Max of them and at the end return the max.
Read this solution " Level Order Traversal, Print each level in separate line" and implement the above approach.
Maximum Width of a binary Tree is : 4