Question: Missing the left and right method /. Returns the number of leaf nodes in this trees/ public int getNumberofLeaves(TreeNodect> root)//TreeNode root added if(root null){ return

Missing the left and right method  Missing the left and right method /. Returns the number of
leaf nodes in this trees/ public int getNumberofLeaves(TreeNodect> root)//TreeNoderoot added if(root null){
return else if(root . left " null root. right-nuuo //else if iif
y// return 1 else// note the recirsive call! return getNumberOfLeaves( rootleft). getNumberofLeaves
(root. right); //else //getNUnberorLeaves /* Returns an ArrayList containing all elements in
preorder of the specified element's left sub-tree public ArrayListcE> leftSubTree(E e)( //teft
for you to implement in Lab 9 Returns an ArrayList containing all
etements in preorder of the specified elenent's right sub-tree public ArrayListsE+ rightSubTree(E
ef //left for you to inplenent in Lab 9 Returns the inorder

/. Returns the number of leaf nodes in this trees/ public int getNumberofLeaves(TreeNodect> root)//TreeNoderoot added if(root null){ return else if(root . left " null root. right-nuuo //else if iif y// return 1 else// note the recirsive call! return getNumberOfLeaves( rootleft). getNumberofLeaves (root. right); //else //getNUnberorLeaves /* Returns an ArrayList containing all elements in preorder of the specified element's left sub-tree public ArrayListcE> leftSubTree(E e)( //teft for you to implement in Lab 9 Returns an ArrayList containing all etements in preorder of the specified elenent's right sub-tree public ArrayListsE+ rightSubTree(E ef //left for you to inplenent in Lab 9 Returns the inorder predecessor of the specified dement / public E inorderPredecessor(E e)( //left tor you to implesent in Lab 9 TreeNodeE> parent = null; TreeNode current root; while (current != null) { if (e.compareTo(current.elenent) a) ( parent current; current = current, left; else if (e.compareTolcurrent.elenent) 8) parent current; MacBook Air 19 7

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!