daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Feb 25th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       Node current = root;
  2.       boolean found = false;
  3.       if(current.getKeyOne().compareTo(x) == 0 || current.getKeyTwo().compareTo(x) == 0) {
  4.             found = true;
  5.           }
  6.       if(current.getKeyOne().compareTo(x) > 0) {
  7.             while(current.left != null && found != true) {
  8.                 current = current.left;
  9.                 if(current.getKeyOne().compareTo(x) == 0 || current.getKeyTwo().compareTo(x) == 0) {
  10.                         found = true;
  11.                     }
  12.             }
  13.       }
  14.       if(current.getKeyTwo().compareTo(x) < 0) {
  15.             while(current.right != null && found != true) {
  16.                 current = current.right;
  17.                 if(current.getKeyOne().compareTo(x) == 0 || current.getKeyTwo().compareTo(x) == 0) {
  18.                     found = true;
  19.                 }
  20.             }
  21.       }
  22.       if(current.getKeyTwo() != null) {
  23.             return String.valueOf(current.getKeyOne()) + " " + String.valueOf(current.getKeyTwo());
  24.       }
  25.       else {
  26.             return String.valueOf(current.getKeyOne());
  27.       }
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