How to delete the largest node in Binary search Tree -


i trying delete largest node in binary search tree, thougth these code below should able reason not. please!

public void remove() {             node current = root;              while(true){                 node parent = current;                 current = current.getrighchild();                  if (current == null){                     parent.setrighchild(null);                     return;                 }             }         }        

public void remove()           {         root = deletemax(root);         }           private node deletemax(node x ) {     if (x.getrighchild() == null)         {         return x.getleftchild();          }     x.setrighchild(deletemax(x.getrighchild()));     return x; 

}


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -