(String[] args)
| 9 | private static final int minDepth = 4; |
| 10 | |
| 11 | public static void main(String[] args){ |
| 12 | int n = 0; |
| 13 | if (args.length > 0) n = Integer.parseInt(args[0]); |
| 14 | |
| 15 | int maxDepth = (minDepth + 2 > n) ? minDepth + 2 : n; |
| 16 | int stretchDepth = maxDepth + 1; |
| 17 | |
| 18 | int check = (TreeNode.bottomUpTree(0,stretchDepth)).itemCheck(); |
| 19 | System.out.println("stretch tree of depth "+stretchDepth+"\t check: " + check); |
| 20 | |
| 21 | TreeNode longLivedTree = TreeNode.bottomUpTree(0,maxDepth); |
| 22 | |
| 23 | for (int depth=minDepth; depth<=maxDepth; depth+=2){ |
| 24 | int iterations = 1 << (maxDepth - depth + minDepth); |
| 25 | check = 0; |
| 26 | |
| 27 | for (int i=1; i<=iterations; i++){ |
| 28 | check += (TreeNode.bottomUpTree(i,depth)).itemCheck(); |
| 29 | check += (TreeNode.bottomUpTree(-i,depth)).itemCheck(); |
| 30 | } |
| 31 | System.out.println((iterations*2) + "\t trees of depth " + depth + "\t check: " + check); |
| 32 | } |
| 33 | System.out.println("long lived tree of depth " + maxDepth + "\t check: "+ longLivedTree.itemCheck()); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | private static class TreeNode |
nothing calls this directly
no test coverage detected