daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public int prof(E no, List<E> path){
  2.     Node node = root;
  3.     int prof = 0;
  4.     boolean found = false;
  5.     List<Node> path = new ArrayList<>();
  6.     while(!found){
  7.         if(node.getElement().equals(no)){
  8.             path.add(no);
  9.             found = true;
  10.         }else{
  11.             Node right = root.getLeft();
  12.             Node left = root.getRight();
  13.             if(no > node){
  14.                 prof += 2;
  15.                 path.add(right);
  16.                 node = right;
  17.             }else{
  18.                 prof += 2;
  19.                 path.add(left);
  20.                 node = left;
  21.             }
  22.         }
  23.     }
  24.     return
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top