algorithm

package
v0.0.0-...-d7ca37d Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryBound

func BinaryBound(first, last int, comp func(middle int) bool) int

BinaryBound std::lower_bound or std::upper_bound

chose (middle, last) when comp return true
chose [first, middle) when comp return false
lower_bound comp example, { return a[middle] < v }
upper_bound comp example, { return a[middle] <= v }

func NextPermutation

func NextPermutation[T any](
	slice []T, first, last int,
	less func(a, b T) bool,
) bool

NextPermutation std::next_permutation

func Reverse

func Reverse[T any](slice []T, first, last int)

Reverse std::reverse

Types

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

Queue std::queue

func NewQueue

func NewQueue[T any](x ...T) Queue[T]

NewQueue create a new Queue

func (Queue[T]) Back

func (que Queue[T]) Back() T

func (Queue[T]) Empty

func (que Queue[T]) Empty() bool

func (Queue[T]) Front

func (que Queue[T]) Front() T

func (Queue[T]) Pop

func (que Queue[T]) Pop() T

func (Queue[T]) Push

func (que Queue[T]) Push(v T)

func (Queue[T]) Size

func (que Queue[T]) Size() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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