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

Function is_leaf

Trees/Binary_tree_Array.c:69–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69int is_leaf(int index)
70{
71 // to check of the indices of the left and right children are valid or not
72 if(!get_left_child(index) && !get_right_child(index))
73 return 1;
74 // to check if both the children of the node are null or not
75 if(tree[get_left_child(index)]=='\0' && tree[get_right_child(index)]=='\0')
76 return 1;
77 return 0; // node is not a leaf
78}
79
80int get_max(int a, int b)
81{

Callers 1

get_heightFunction · 0.85

Calls 2

get_left_childFunction · 0.85
get_right_childFunction · 0.85

Tested by

no test coverage detected