sorted

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: LGPL-3.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmp

type Cmp func(a interface{}, b interface{}) int

Cmp function, a < b -> -1, a == b -> 0, a > b -> 1

type Slice

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

Slice is a sorted array

func NewSlice

func NewSlice(cmp Cmp) *Slice

NewSlice return a new slice

func (*Slice) Del

func (s *Slice) Del(val interface{})

Del the given value

func (*Slice) Index

func (s *Slice) Index(index int) interface{}

Index return the value at the given value

func (*Slice) Left

func (s *Slice) Left() interface{}

Left return the min value, not pop out

func (*Slice) Len

func (s *Slice) Len() int

Len return the length of slice

func (*Slice) PopLeft

func (s *Slice) PopLeft() interface{}

PopLeft pop out the min value

func (*Slice) PopRight

func (s *Slice) PopRight() interface{}

PopRight pop out the max value

func (*Slice) Push

func (s *Slice) Push(val interface{})

Push a new value into slice

func (*Slice) Right

func (s *Slice) Right() interface{}

Right return the max value, not pop out

Jump to

Keyboard shortcuts

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