validate method

void validate ()

Validate this tree. For testing.

Implementation

void validate() {
  _validateStructure(_root);
  _validateMetrics(_root);

  int freeCount = 0;
  int freeNode = _freeList;
  while (freeNode != NULL_NODE) {
    assert(0 <= freeNode && freeNode < _nodeCapacity);
    freeNode = _parent[freeNode];
    ++freeCount;
  }

  assert(getHeight() == computeHeight());
  assert(_nodeCount + freeCount == _nodeCapacity);
}