1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-13 09:12:28 +08:00

feat: update deleteTreeNode func

This commit is contained in:
dudaodong
2022-03-01 11:13:44 +08:00
parent bf7db0ded2
commit aa28479d11
3 changed files with 44 additions and 10 deletions

View File

@@ -63,6 +63,11 @@ func (t *BSTree[T]) InOrderTraverse() []T {
return inOrderTraverse(t.root)
}
// Depth returns the calculated depth of a binary saerch tree
func (t *BSTree[T]) Depth() int {
return calculateDepth(t.root, 0)
}
// Print the bstree structure
func (t *BSTree[T]) Print() {
maxLevel := t.NodeLevel(t.root)