Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int maxDepth(TNODE *root){
- if (!root) return 0;
- if (root && !root.m_L && !root.m_R) return 1;
- int counterL = maxDepth(root.m_L);
- int counterR = maxDepth(root.m_R);
- if (counterL > counterR) return 1 + counterL;
- else return 1 + counterR;
- }
Add Comment
Please, Sign In to add comment