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

test: add unit test TestBSTree_IsSubTree

This commit is contained in:
dudaodong
2022-04-27 11:36:51 +08:00
parent 0d48778886
commit 61c7012e17
3 changed files with 14 additions and 16 deletions

View File

@@ -226,8 +226,8 @@ func isSubTree[T any](superTreeRoot, subTreeRoot *datastructure.TreeNode[T], com
if comparator.Compare(superTreeRoot.Value, subTreeRoot.Value) != 0 {
return false
}
return isSubTree(superTreeRoot.Left, subTreeRoot.Left, comparator) && hasSubTree(superTreeRoot.Right, subTreeRoot.Right, comparator)
res := isSubTree(superTreeRoot.Left, subTreeRoot.Left, comparator) && isSubTree(superTreeRoot.Right, subTreeRoot.Right, comparator)
return res
}
func max(a, b int) int {