mirror of
https://gitee.com/johng/gf
synced 2026-07-04 13:02:36 +08:00
18 lines
263 B
Go
18 lines
263 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/container/gtree"
|
|
)
|
|
|
|
func main() {
|
|
tree := gtree.NewRedBlackTree(func(v1, v2 interface{}) int {
|
|
return v1.(int) - v2.(int)
|
|
})
|
|
for i := 0; i < 10; i++ {
|
|
tree.Set(i, i)
|
|
}
|
|
tree.Print()
|
|
tree.Flip()
|
|
tree.Print()
|
|
}
|