btree: add basic in memory b-tree with integers
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-07-30 17:29:13 +02:00
parent 4f361f7d55
commit 33657122f9
4 changed files with 670 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
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")
}
}