mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
feat: add HasSubTree func for BSTree
This commit is contained in:
1 parent
e98c46c903
commit
0d48778886
3 files changed
+30
-8
No files matched your search
@@ -133,3 +133,25 @@ func TestBSTree_Depth(t *testing.T) {
|
||||
|
||||
assert.Equal(bstree.Depth(), 4)
|
||||
}
|
||||
|
||||
|
||||
func TestBSTree_IsSubTree(t *testing.T) {
|
||||
assert := internal.NewAssert(t, "TestBSTree_IsSubTree")
|
||||
|
||||
superTree := NewBSTree(6, &intComparator{})
|
||||
superTree.InsertNode(7)
|
||||
superTree.InsertNode(5)
|
||||
superTree.InsertNode(2)
|
||||
superTree.InsertNode(4)
|
||||
|
||||
superTree.Print()
|
||||
|
||||
subTree1 := NewBSTree(3, &intComparator{})
|
||||
subTree1.InsertNode(5)
|
||||
subTree1.InsertNode(2)
|
||||
subTree1.InsertNode(4)
|
||||
|
||||
assert.Equal(true, superTree)
|
||||
subTree1.Print()
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user