| 83 | } |
| 84 | |
| 85 | int get_height(int index) |
| 86 | { |
| 87 | // if the node is a leaf the the height will be 0 |
| 88 | // the height will be 0 also for the invalid cases |
| 89 | if(tree[index]=='\0' || index<=0 || is_leaf(index)) |
| 90 | return 0; |
| 91 | // height of node i is 1+ maximum among the height of left subtree and the height of right subtree |
| 92 | return(get_max(get_height(get_left_child(index)), get_height(get_right_child(index)))+1); |
| 93 | } |
nothing calls this directly
no test coverage detected