1 votes 1 votes int A(struct node* node) { if (node==NULL) return 0; else { int lDepth = A(node->left); int rDepth = A(node->right); /* use the larger one */ if (lDepth > rDepth) return(lDepth+1); else return(rDepth+1); } } Programming in C self-made algorithms binary-tree + – Aghori asked Jul 4, 2017 Aghori 477 views answer comment Share Follow See 1 comment See all 1 1 comment reply Deepak Kumar 12 commented Jul 4, 2017 reply Follow Share Above Code segment calculate height of tree. 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes At every node function call is made. It returns the number of levels in tree or height of tree if we consider root at level-1. Such questions can be answered by taking small tree and see what function returns. Rahul Jain25 answered Jul 4, 2017 Rahul Jain25 comment Share Follow See all 0 reply Please log in or register to add a comment.