algorithm

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count[T any](first, last iterator.ConstIterator[T], value T, cmp comparator.Comparator[T]) int

Count returns the number of elements that their value is equal to value in range [first, last)

func CountIf

func CountIf[T any](first, last iterator.ConstIterator[T], f func(iterator.ConstIterator[T]) bool) int

CountIf returns the number of elements are satisfied the function f in range [first, last)

func Find

func Find[T any](first, last iterator.ConstIterator[T], value T, cmp comparator.Comparator[T]) iterator.ConstIterator[T]

Find finds the first element that its value is equal to value in range [first, last), and returns its iterator, or last if not found

func FindIf

func FindIf[T any](first, last iterator.ConstIterator[T], f func(iterator.ConstIterator[T]) bool) iterator.ConstIterator[T]

FindIf finds the first element that is satisfied the function f, and returns its iterator, or last if not found

func MaxElement added in v1.1.0

func MaxElement[T any](first, last iterator.ConstIterator[T], cmp comparator.Comparator[T]) iterator.ConstIterator[T]

MaxElement returns an Iterator to the largest element in the range [first, last). If several elements in the range are equivalent to the largest element, returns the iterator to the first such element. Returns last if the range is empty.

func MinElement added in v1.1.0

func MinElement[T any](first, last iterator.ConstIterator[T], cmp comparator.Comparator[T]) iterator.ConstIterator[T]

MinElement returns an Iterator to the smallest element value in the range [first, last). If several elements in the range are equivalent to the smallest element value, returns the iterator to the first such element. Returns last if the range is empty.

func Reverse

func Reverse[T any](first, last iterator.BidIterator[T])

Reverse reverse the elements in the range [first, last]

func Swap

func Swap[T any](a, b iterator.Iterator[T])

Swap swaps the value of two iterator

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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