Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. static int trav(int key, node root) {
  2.  
  3. if (root == null) {
  4. return 0;
  5. }
  6.  
  7. if (root.left != null) {
  8.  
  9. trav(key, root.left);
  10.  
  11. }
  12. if (root.right != null) {
  13. trav(key, root.right);
  14.  
  15. }
  16. if (root.right == null && root.left == null) {
  17. System.out.println("Key " + root.key);
  18.  
  19. }
  20. return root.key;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement