Share Pastebin
Guest
Public paste!

printtree

By: a guest | Mar 19th, 2010 | Syntax: Java 5 | Size: 0.35 KB | Hits: 76 | Expires: Never
Copy text to clipboard
  1. private static void printTree(TreeNode current){
  2.                 if (current.getLeft() != null){
  3.                         System.out.println(current.getValue() + "'s mother: " + current.getLeft());
  4.                         printTree(current.getLeft());
  5.                 }
  6.                 if (current.getRight() != null){
  7.                         System.out.println(current.getValue() + "'s father: " + current.getRight());
  8.                         printTree(current.getRight());
  9.                 }
  10.         }