Created
June 30, 2016 07:31
-
-
Save AdelinGhanaem/5ea7194c0d1ad52230b0f92e1760e300 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PreOrder { | |
| public void traverse(Node root) { | |
| if (root == null) { | |
| return; | |
| } | |
| System.out.print(root.getValue()+" > "); | |
| traverse(root.getLeft()); | |
| traverse(root.getRight()); | |
| } | |
| public static void main(String[] strings) { | |
| Node root = SimpleTreeFactory.get(); | |
| PreOrder preOrder = new PreOrder(); | |
| preOrder.traverse(root); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment