()
| 737 | } |
| 738 | |
| 739 | func (tree B2DynamicTree) GetMaxBalance() int { |
| 740 | maxBalance := 0 |
| 741 | for i := 0; i < tree.M_nodeCapacity; i++ { |
| 742 | node := &tree.M_nodes[i] |
| 743 | if node.Height <= 1 { |
| 744 | continue |
| 745 | } |
| 746 | |
| 747 | B2Assert(node.IsLeaf() == false) |
| 748 | |
| 749 | child1 := node.Child1 |
| 750 | child2 := node.Child2 |
| 751 | balance := AbsInt(tree.M_nodes[child2].Height - tree.M_nodes[child1].Height) |
| 752 | maxBalance = MaxInt(maxBalance, balance) |
| 753 | } |
| 754 | |
| 755 | return maxBalance |
| 756 | } |
| 757 | |
| 758 | func (tree *B2DynamicTree) RebuildBottomUp() { |
| 759 | //int* nodes = (int*)b2Alloc(m_nodeCount * sizeof(int)); |
no test coverage detected