Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

with clear explaination please 7. You are to complete the code below for the fun

ID: 3907334 • Letter: W

Question

with clear explaination please

7. You are to complete the code below for the function greater count that returns the number of values in a binary search tree that are greater than x. You may assume available the function nodecount (binNode *p) that returns the number of nodes in the tree with root pointer p An additional requirement is that in each of the return statements below, there can be at most one recursive call to greater_count. Thus you will need to use the BST property def greater_count (binNode root,int x)

Explanation / Answer

def greater_count(binNode *root,int x)

{

//if right child exists ...

//...then number of nodes in right subtree should be returned

if(root->right)

{

return nodecount(root->right)

}

//else if right child does not exists ...

//...then no node is greater hence return 0

return 0;

}

Hope i have answered your question satisfactorily.Leave doubts in comment section if any.