Added avl height benchmark
This commit is contained in:
@@ -58,3 +58,11 @@ void deleteTree(Tree *root) {
|
||||
delete root;
|
||||
}
|
||||
}
|
||||
|
||||
int getHeight(Tree *root, int height) {
|
||||
if (root == nullptr) return height;
|
||||
height += 1;
|
||||
int leftHeight = getHeight(root->left, height);
|
||||
int rightHeight = getHeight(root->right, height);
|
||||
return std::max(leftHeight, rightHeight) + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user