Predecessor returns the Predecessor of the node of Key if there is no predecessor, return default value of type T and false otherwise return the Key of predecessor and true
(key T)
| 143 | // if there is no predecessor, return default value of type T and false |
| 144 | // otherwise return the Key of predecessor and true |
| 145 | func (t *BinarySearch[T]) Predecessor(key T) (T, bool) { |
| 146 | node, ok := searchTreeHelper[T](t.Root, t._NIL, key) |
| 147 | if !ok { |
| 148 | var dft T |
| 149 | return dft, ok |
| 150 | } |
| 151 | return predecessorHelper[T](node, t._NIL) |
| 152 | } |
| 153 | |
| 154 | // Successor returns the Successor of the node of Key |
| 155 | // if there is no successor, return default value of type T and false |
nothing calls this directly
no outgoing calls
no test coverage detected