leftist

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	First = Comp(-1) // Comes first.
	Equiv = Comp(0)  // Same level..
	Last  = Comp(+1) // Comes after.

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Comp

type Comp int8

type Comparer

type Comparer interface {
	Comp(Comparer) Comp
}

type Elem

type Elem struct {
	// contains filtered or unexported fields
}

func (*Elem) Val

func (el *Elem) Val() Comparer

Returns the value stored in el

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

func New

func New() *Tree

Creates a new empty tree t. *)

func (*Tree) Empty

func (t *Tree) Empty()

Empties the tree t.

func (*Tree) Erase

func (t *Tree) Erase(e *Elem)

Deletes the *Elem e of the tree t.

func (*Tree) First

func (t *Tree) First(e **Elem) Comparer

Returns one of the first values of the tree t, and the *Elem containing it in e. Returns nil and nil if the tree is empty.

func (*Tree) Insert

func (t *Tree) Insert(v Comparer) *Elem

Inserts the value v in the tree t and returns the *Elem containing it.

func (*Tree) IsEmpty

func (t *Tree) IsEmpty() bool

Returns true if t is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL