Given an N-Ary tree, find depth of the tree. An N-Ary tree is a tree in which nodes can have at most N children.
N-Ary tree can be traversed just like a normal tree. We just have to consider all childs of a given node and recursively call that function on every node.
This article is contributed by Shubham Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Sum of nodes at maximum depth of a Binary Tree | Set 2
- Sum of nodes at maximum depth of a Binary Tree
- Replace node with depth in a binary tree
- Find Minimum Depth of a Binary Tree
- Calculate depth of a full Binary tree from Preorder
- Depth of the deepest odd level node in Binary Tree
- Sum of nodes at maximum depth of a Binary Tree | Iterative Approach
- Write a Program to Find the Maximum Depth or Height of a Tree
- Find depth of the deepest odd level leaf node
- Maximum sub-tree sum in a Binary Tree such that the sub-tree is also a BST
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Convert an arbitrary Binary Tree to a tree that holds Children Sum Property
- Print Binary Tree levels in sorted order | Set 3 (Tree given as array)
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
- Convert a given Binary tree to a tree that holds Logical AND property