SHARE
TWEET

Untitled

a guest Jan 21st, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void nonSortedTree() {
  2.         System.out.print(root.key+" ");
  3.         recursiveNonSortedTree(root.left, root.right);
  4.     }
  5.  
  6.     private void recursiveNonSortedTree(Node left, Node right) {
  7.         if (left != null) {
  8.             System.out.print(left.key+" ");
  9.         }
  10.         if (right != null) {
  11.             System.out.print(right.key+" ");
  12.         }
  13.  
  14.         if (left != null) {
  15.             recursiveNonSortedTree(left.left, left.right);
  16.         }
  17.         if (right != null) {
  18.             recursiveNonSortedTree(right.left, right.right);
  19.         }
  20.     }
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