This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user