SHOW:
|
|
- or go back to the newest paste.
1 | int avh1(Tree t) { | |
2 | - | if ( t.left == null && t.right == null ) { |
2 | + | if ( t.left == Tree.EMPTY && t.right == TREE.EMPTY ) { |
3 | return 0; | |
4 | } | |
5 | else { | |
6 | return ( t.left.leafCount*(avh1(t.left) + 1) | |
7 | + t.right.leafCount*(avh1(t.right) + 1)) | |
8 | / (t.left.leafCount() + t.right.leafCount()); | |
9 | } | |
10 | } |