MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / Search

Method Search

structure/tree/btree.go:58–72  ·  view source on GitHub ↗
(key T)

Source from the content-addressed store, hash-verified

56}
57
58func (node *BTreeNode[T]) Search(key T) bool {
59 i := 0
60 for ; i < node.numKeys; i++ {
61 if key == node.keys[i] {
62 return true
63 }
64 if key < node.keys[i] {
65 break
66 }
67 }
68 if node.isLeaf {
69 return false
70 }
71 return node.children[i].Search(key)
72}
73
74func (tree *BTree[T]) Search(key T) bool {
75 if tree.root == nil {

Callers

nothing calls this directly

Calls 1

SearchMethod · 0.45

Tested by

no test coverage detected