Answer the following questions and bring them to your recitation on Oct 28-30, 2002.
Here are some declarations.
melon / \ / \ grape pear / \ \ / \ \ apple lemon tangerinethe call
tvectorwill return a vector represented by the followingvec; treeToVector(root, vec);
("apple", "grape", "lemon", "melon", "pear", "tangerine")This function should be recursive and use push_back to insert into the vector.
void treeToVector(TreeNode * tree, tvector& vec) { }
T(n) = T(0) = O(1)
You may assume the function height exists and it runs in O(N) time on a tree with N nodes.
The function isBalanced should be recursive and should call the height function above.