mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
Implemented BTree Example
1.NewBTree 2.NewBTreeFrom
This commit is contained in:
@ -2,6 +2,156 @@
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with gm file,
|
||||
// You can obtain one at https://github.com/gogf/gf.
|
||||
// You can obtain one at https://github.com/Agogf/gf.
|
||||
|
||||
package gtree_test
|
||||
|
||||
func ExampleBTree_Clone() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Set() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Sets() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Get() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetOrSet() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetOrSetFunc() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetOrSetFuncLock() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetVar() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetVarOrSet() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetVarOrSetFunc() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_GetVarOrSetFuncLock() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_SetIfNotExist() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_SetIfNotExistFunc() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_SetIfNotExistFuncLock() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Contains() {
|
||||
|
||||
}
|
||||
func ExampleBTree_Remove() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Removes() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_IsEmpty() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Size() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Keys() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Values() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Map() {
|
||||
|
||||
}
|
||||
func ExampleBTree_MapStrAny() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Clear() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Replace() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Height() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Left() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Right() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_String() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Search() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Print() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_Iterator() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_IteratorFrom() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_IteratorAsc() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_IteratorAscFrom() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_IteratorDesc() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_IteratorDescFrom() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleBTree_MarshalJSON() {
|
||||
|
||||
}
|
||||
|
||||
64
container/gtree/gtree_z_example_test.go
Normal file
64
container/gtree/gtree_z_example_test.go
Normal file
@ -0,0 +1,64 @@
|
||||
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with gm file,
|
||||
// You can obtain one at https://github.com/Agogf/gf.
|
||||
|
||||
package gtree_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/container/gtree"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/gutil"
|
||||
)
|
||||
|
||||
func ExampleNewAVLTree() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleNewAVLTreeFrom() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleNewBTree() {
|
||||
bTree := gtree.NewBTree(3, gutil.ComparatorString)
|
||||
for i := 0; i < 6; i++ {
|
||||
bTree.Set("key"+gconv.String(i), "val"+gconv.String(i))
|
||||
}
|
||||
fmt.Println(bTree)
|
||||
|
||||
// output:
|
||||
// key0
|
||||
// key1
|
||||
// key2
|
||||
// key3
|
||||
// key4
|
||||
// key5
|
||||
}
|
||||
|
||||
func ExampleNewBTreeFrom() {
|
||||
bTree := gtree.NewBTree(3, gutil.ComparatorString)
|
||||
for i := 0; i < 6; i++ {
|
||||
bTree.Set("key"+gconv.String(i), "val"+gconv.String(i))
|
||||
}
|
||||
|
||||
otherBTree := gtree.NewBTreeFrom(3, gutil.ComparatorString, bTree.Map())
|
||||
fmt.Println(otherBTree)
|
||||
|
||||
// output:
|
||||
// key0
|
||||
// key1
|
||||
// key2
|
||||
// key3
|
||||
// key4
|
||||
// key5
|
||||
}
|
||||
|
||||
func ExampleNewRedBlackTree() {
|
||||
|
||||
}
|
||||
|
||||
func ExampleNewRedBlackTreeFrom() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user