Documentation
¶
Overview ¶
Package treap implements a treap. See https://en.wikipedia.org/wiki/Treap for more details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Treap ¶
type Treap[T any] struct { // contains filtered or unexported fields }
Treap represents a treap. Zero value of Treap is invalid treap, should be used only with New() or NewWithSource().
func New ¶
func New[T constraints.Ordered]() *Treap[T]
New returns an initialized treap. rand.Rand is used with time.Now().UnixNano(). For custom rand.Rand use Treap.SetSource.
func NewWithComparator ¶
NewWithComparator returns an initialized treap using given comparator.
func (*Treap[T]) All ¶ added in v0.1.2
func (t *Treap[T]) All() []T
All returns all elements from tree. Returned slice is sorted.
func (*Treap[T]) Remove ¶
Remove removes value from tree. Returns true if tree contained given value, false otherwise.
Click to show internal directories.
Click to hide internal directories.