(String[] args)
| 26 | } |
| 27 | |
| 28 | public static void main(String[] args) { |
| 29 | // Create balanced tree |
| 30 | int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; |
| 31 | TreeNode root = TreeNode.createMinimalBST(array); |
| 32 | System.out.println("Root? " + root.data); |
| 33 | System.out.println("Is balanced? " + isBalanced(root)); |
| 34 | |
| 35 | // Could be balanced, actually, but it's very unlikely... |
| 36 | TreeNode unbalanced = new TreeNode(10); |
| 37 | for (int i = 0; i < 10; i++) { |
| 38 | unbalanced.insertInOrder(AssortedMethods.randomIntInRange(0, 100)); |
| 39 | } |
| 40 | System.out.println("Root? " + unbalanced.data); |
| 41 | System.out.println("Is balanced? " + isBalanced(unbalanced)); |
| 42 | } |
| 43 | |
| 44 | } |
nothing calls this directly
no test coverage detected