datastructures

package
v0.0.0-...-30497a8 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 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 Queue

type Queue[T any] []T

func (*Queue[T]) Dequeue

func (s *Queue[T]) Dequeue() (T, bool)

func (*Queue[T]) Enqueue

func (s *Queue[T]) Enqueue(val T)

func (*Queue[T]) IsEmpty

func (s *Queue[T]) IsEmpty() bool

func (*Queue[T]) Len

func (s *Queue[T]) Len() int

type Stack

type Stack[T any] []T

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (T, bool)

func (*Stack[T]) PopN

func (s *Stack[T]) PopN(n int) ([]T, bool)

func (*Stack[T]) Push

func (s *Stack[T]) Push(val T)

func (*Stack[T]) PushN

func (s *Stack[T]) PushN(val []T)

type TopList

type TopList[T constraints.Ordered] struct {
	MaxSize int
	Values  []T
}

func NewTopList

func NewTopList[T constraints.Ordered](size int) *TopList[T]

func (*TopList[T]) TryPush

func (t *TopList[T]) TryPush(val T) bool

TryPush will add `val` to the list if it's greater than at least 1 number in the list in order, and returns true. Otherwise it does nothing and returns false

Jump to

Keyboard shortcuts

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