Guest User

Untitled

a guest
May 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. public class node {
  2.     node left;
  3.     node right;
  4.     String data;
  5.        
  6.     public node(String data) {
  7.         this.data = data;
  8.     }
  9. }
  10.  
  11. ===
  12.  
  13. public class tree {
  14.  
  15.     public static boolean insert(node parent, String data, boolean dir){
  16.  
  17.         if (dir == true){
  18.             parent.left = new node(data);
  19.             return true;
  20.         }
  21.  
  22.         parent.right = new node(data);
  23.         return true;
  24.     }
  25. }
Add Comment
Please, Sign In to add comment