MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / NewBTreeNode

Function NewBTreeNode

structure/tree/btree.go:24–33  ·  view source on GitHub ↗
(maxKeys int, isLeaf bool)

Source from the content-addressed store, hash-verified

22}
23
24func NewBTreeNode[T constraints.Ordered](maxKeys int, isLeaf bool) *BTreeNode[T] {
25 if maxKeys <= 0 {
26 panic("BTree maxKeys cannot be zero")
27 }
28 return &BTreeNode[T]{
29 keys: make([]T, maxKeys),
30 children: make([]*BTreeNode[T], maxKeys+1),
31 isLeaf: isLeaf,
32 }
33}
34
35func NewBTree[T constraints.Ordered](maxKeys int) *BTree[T] {
36 if maxKeys <= 2 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected