a balanced tree is if its the difference between the left subtree
and the right subtree is smaller than 2.
i need to build a function which return 1 if the tree is balanced
and 0 if else.
how to store the height of each node from the ground?
a balanced tree is if its the difference between the left subtree
and the right subtree is smaller than 2.
i need to build a function which return 1 if the tree is balanced
and 0 if else.
how to store the height of each node from the ground?
Try one of the various data types which store numbers.
Quzah.
Hope is the first step on the road to disappointment.
Well you can create a height recursive function to determine the height.
Code:int height (link t) { int left,right; if (t == NULL) return -1; left = height(t->l); right = height(t->r); if (left > right) return left + 1; else return right +1; }
Or you can just wait around and someone will do everything for you AGAIN!
Quzah.
Hope is the first step on the road to disappointment.