private function reCalculateHeights(BinaryTree $root = null) { if ($root === null) { return; } $this->reCalculateHeights($root->left()); $this->reCalculateHeights($root->right()); $root->recalculateHeight(); }
private function reCalculateHeights(BinaryTree $root = null) { if ($root === null) { return; } $this->reCalculateHeights($root->left()); $this->reCalculateHeights($root->right()); $root->recalculateHeight(); }