Documentation ¶
Overview ¶
Package splaytree implements a splay tree. See https://en.wikipedia.org/wiki/Splay_tree for more details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplayTree ¶
type SplayTree[T any] struct { // contains filtered or unexported fields }
SplayTree represents a splay tree. Zero value of SplayTree is empty splay tree.
func NewWithComparator ¶
NewWithComparator returns an initialized splay tree using given comparator.
func (*SplayTree[T]) All ¶
func (s *SplayTree[T]) All() []T
All returns all elements from tree. Returned slice is sorted.
func (*SplayTree[T]) Contains ¶
Contains returns true if tree contains given value, false otherwise.
func (*SplayTree[T]) Insert ¶
func (s *SplayTree[T]) Insert(value T)
Insert inserts value in a tree.
Click to show internal directories.
Click to hide internal directories.