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

Method Successor

structure/tree/rbtree.go:166–173  ·  view source on GitHub ↗

Successor returns the Successor of the node of Key if there is no successor, return default value of type T and false otherwise return the Key of successor and true

(key T)

Source from the content-addressed store, hash-verified

164// if there is no successor, return default value of type T and false
165// otherwise return the Key of successor and true
166func (t *RB[T]) Successor(key T) (T, bool) {
167 node, ok := searchTreeHelper[T](t.Root, t._NIL, key)
168 if !ok {
169 var dft T
170 return dft, ok
171 }
172 return successorHelper[T](node, t._NIL)
173}
174
175func (t *RB[T]) pushHelper(x *RBNode[T], key T) {
176 y := t._NIL

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected