day33

package
v0.0.0-...-36687a4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaxPQ

type MaxPQ []int

MaxPQ is a MaxHeap

func (MaxPQ) Len

func (pq MaxPQ) Len() int

func (MaxPQ) Less

func (pq MaxPQ) Less(i, j int) bool

func (*MaxPQ) Pop

func (pq *MaxPQ) Pop() interface{}

Pop is not called, but needed to meet the interface.

func (*MaxPQ) Push

func (pq *MaxPQ) Push(x interface{})

Push adds to the MaxHeap.

func (MaxPQ) Swap

func (pq MaxPQ) Swap(i, j int)

type MinPQ

type MinPQ []int

MinPQ is a MinHeap

func (MinPQ) Len

func (pq MinPQ) Len() int

func (MinPQ) Less

func (pq MinPQ) Less(i, j int) bool

func (*MinPQ) Pop

func (pq *MinPQ) Pop() interface{}

Pop removes the smallest element from the MinHeap.

func (*MinPQ) Push

func (pq *MinPQ) Push(x interface{})

Push adds a new value to the MinHeap.

func (MinPQ) Swap

func (pq MinPQ) Swap(i, j int)

type RunningMedian

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

RunningMedian keeps a running median of integers.

func NewRunningMedian

func NewRunningMedian() *RunningMedian

NewRunningMedian returns a new instance of a RunningMedian processor.

func (*RunningMedian) Median

func (rm *RunningMedian) Median(val int) float64

Median returns the running median after adding this value.

Jump to

Keyboard shortcuts

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