MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / get_height

Function get_height

Trees/Binary_tree_Array.c:85–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85int 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}

Callers

nothing calls this directly

Calls 4

is_leafFunction · 0.85
get_maxFunction · 0.85
get_left_childFunction · 0.85
get_right_childFunction · 0.85

Tested by

no test coverage detected