Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void nonSortedTree() {
- System.out.print(root.key+" ");
- recursiveNonSortedTree(root.left, root.right);
- }
- private void recursiveNonSortedTree(Node left, Node right) {
- if (left != null) {
- System.out.print(left.key+" ");
- }
- if (right != null) {
- System.out.print(right.key+" ");
- }
- if (left != null) {
- recursiveNonSortedTree(left.left, left.right);
- }
- if (right != null) {
- recursiveNonSortedTree(right.left, right.right);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement