kvs/main.go
Bartuccio Antoine 33657122f9
All checks were successful
continuous-integration/drone/push Build is passing
btree: add basic in memory b-tree with integers
2019-07-30 17:29:13 +02:00

37 lines
488 B
Go

package main
import (
"fmt"
"git.klmp200.net/klmp200/kvs/btree"
)
func main() {
t := btree.NewBtree(3)
t.Insert(10)
t.Insert(20)
t.Insert(5)
t.Insert(6)
t.Insert(12)
t.Insert(30)
t.Insert(7)
t.Insert(17)
fmt.Print("Traversal of the constructed tree is")
t.Traverse()
k := 6
if t.Search(k) != nil {
fmt.Print("\nPresent")
} else {
fmt.Print("\nNot Present")
}
k = 15
if t.Search(k) != nil {
fmt.Print("\nPresent")
} else {
fmt.Print("\nNot Present")
}
}