Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. public class Tree {
  2.  
  3. public static void main(String[] args) {
  4. // We create the nodes of our tree
  5. Node<String> A = new Node<String>("A");
  6. Node<String> B = new Node<String>("B");
  7. Node<String> C = new Node<String>("C");
  8. Node<String> D = new Node<String>("D");
  9. Node<String> E = new Node<String>("E");
  10. Node<String> F = new Node<String>("F");
  11. Node<String> G = new Node<String>("G");
  12. Node<String> H = new Node<String>("H");
  13. Node<String> I = new Node<String>("I");
  14. Node<String> J = new Node<String>("J");
  15. Node<String> K = new Node<String>("K");
  16.  
  17. // Root and building of the tree
  18. Node<String> root = A;
  19. A.left = B; A.right = C;
  20. B.left = D; B.right = E;
  21. D.left = H; D.right = I;
  22. E.left = J;
  23. C.left = F; C.right = G;
  24. G.left = K;
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement