Created
June 29, 2016 07:56
-
-
Save AdelinGhanaem/463b5e7758c670d0824132c6b34702a0 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 SimpleTreeFactory { | |
| public static Node get() { | |
| //the left part of the tree | |
| Node leaf7 = new Node(null, null, 7); | |
| Node leaf0 = new Node(null, null, 0); | |
| Node node5 = new Node(leaf7, leaf0, 5); | |
| Node node8 = new Node(null, node5, 8); | |
| Node node7 = new Node(node8, null, 7); | |
| //the right part of the tree | |
| Node node1 = new Node(null, null, 1); | |
| Node node2 = new Node(null, node1, 3); | |
| return new Node(node7, node2, 5); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment