slice

package
Version: v0.0.0-...-e494a0c Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaxHeapSliceValueType

type MaxHeapSliceValueType struct {
	Slice *SliceValueType
}

MaxHeapSliceValueType struct for max heap

func (MaxHeapSliceValueType) Fix

func (hp MaxHeapSliceValueType) Fix(i int)

Fix re-establishes heap ordering after i has changed value

func (MaxHeapSliceValueType) Max

func (hp MaxHeapSliceValueType) Max() ValueType

Max returns max element

func (MaxHeapSliceValueType) Pop

func (hp MaxHeapSliceValueType) Pop() ValueType

Pop removes the minimum element

func (MaxHeapSliceValueType) Push

func (hp MaxHeapSliceValueType) Push(v ValueType)

Push v to heap

func (MaxHeapSliceValueType) Remove

func (hp MaxHeapSliceValueType) Remove(i int) ValueType

Remove i-th element

type MinHeapSliceValueType

type MinHeapSliceValueType struct {
	Slice *SliceValueType
}

MinHeapSliceValueType struct for min heap

func (MinHeapSliceValueType) Fix

func (hp MinHeapSliceValueType) Fix(i int)

Fix re-establishes heap ordering after i has changed value

func (MinHeapSliceValueType) Min

func (hp MinHeapSliceValueType) Min() ValueType

Min returns min element

func (MinHeapSliceValueType) Pop

func (hp MinHeapSliceValueType) Pop() ValueType

Pop removes the minimum element

func (MinHeapSliceValueType) Push

func (hp MinHeapSliceValueType) Push(v ValueType)

Push v to heap

func (MinHeapSliceValueType) Remove

func (hp MinHeapSliceValueType) Remove(i int) ValueType

Remove i-th element

type SliceValueType

type SliceValueType []ValueType

SliceValueType type

func NewSliceValueType

func NewSliceValueType(n, m int) SliceValueType

NewSliceValueType creates slice length n

func (*SliceValueType) Append

func (slice *SliceValueType) Append(values ...ValueType)

Append values

func (SliceValueType) Copy

func (slice SliceValueType) Copy() SliceValueType

Copy makes a new independent copy of slice

func (SliceValueType) Get

func (slice SliceValueType) Get(i int) ValueType

Get i-th element

func (SliceValueType) Len

func (slice SliceValueType) Len() int

Len length

func (SliceValueType) Less

func (slice SliceValueType) Less(i, j int) bool

func (*SliceValueType) MaxHeap

func (slice *SliceValueType) MaxHeap() MaxHeapSliceValueType

MaxHeap returns struct with max heap functionality based on SliceValueType

func (*SliceValueType) MinHeap

func (slice *SliceValueType) MinHeap() MinHeapSliceValueType

MinHeap returns struct with min heap functionality based on SliceValueType

func (*SliceValueType) Pop

func (slice *SliceValueType) Pop() interface{}

Pop element

func (*SliceValueType) Prepend

func (slice *SliceValueType) Prepend(values ...ValueType)

Prepend values

func (SliceValueType) Print

func (slice SliceValueType) Print(sep string) string

Print prints using separator

func (*SliceValueType) Push

func (slice *SliceValueType) Push(c interface{})

Push element

func (SliceValueType) Set

func (slice SliceValueType) Set(c ValueType)

Set sets all element to c

func (SliceValueType) SortAsc

func (slice SliceValueType) SortAsc()

SortAsc sort ascending

func (SliceValueType) SortDesc

func (slice SliceValueType) SortDesc()

SortDesc sort descending

func (SliceValueType) SpiralIterator

func (slice SliceValueType) SpiralIterator() []Coordinate

SpiralIterator returns []Coordinate in spiral order

func (SliceValueType) String

func (slice SliceValueType) String() string

String is for print

func (SliceValueType) Swap

func (slice SliceValueType) Swap(i, j int)

Swap two elements

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL