NewRB creates a new Red-Black Tree
()
| 55 | |
| 56 | // NewRB creates a new Red-Black Tree |
| 57 | func NewRB[T constraints.Ordered]() *RB[T] { |
| 58 | leaf := &RBNode[T]{color: Black, left: nil, right: nil} |
| 59 | leaf.parent = leaf |
| 60 | return &RB[T]{ |
| 61 | Root: leaf, |
| 62 | _NIL: leaf, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // Empty determines the Red-Black tree is empty |
| 67 | func (t *RB[T]) Empty() bool { |
nothing calls this directly
no outgoing calls
no test coverage detected