Zig-Zag World of Algorithm and Data Structures
Home
Home
Basic Data Structures
Advance Data Structures
Algorithms
Exercises
Interview Questions
Puzzles
Design Questions
Conferences and Papers
About The Blog
Thursday, January 5, 2012
Find Depth of a binary tree
int BSTree::getDepth(Node* node)
{
if(!node)
return 0;
int ld = getDepth(node->left);
int rd = getDepth(node->right);
return MAX(ld, rd) + 1;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)

## No comments:

## Post a Comment