Documentation
¶
Index ¶
- func BinarySearch[T any](first, last iterator.RandomAccessIterator[T], val T, ...) bool
- func JoinArrays[T Ordered](leftArr []T, rightArr []T) []T
- func LowerBound[T any](first, last iterator.RandomAccessIterator[T], val T, ...) iterator.RandomAccessIterator[T]
- func MergeSorter[T Ordered](array []T) []T
- func NextPermutation[T any](first, last iterator.RandomAccessIterator[T], cmp comparator.Comparator[T]) bool
- func NthElement[T any](first, last iterator.RandomAccessIterator[T], n int, ...)
- func QuickSorter[T Ordered](elements []T, below int, upper int)
- func Sort[T any](first, last iterator.RandomAccessIterator[T], cmp comparator.Comparator[T])
- func Stable[T any](first, last iterator.RandomAccessIterator[T], cmp comparator.Comparator[T])
- func UpperBound[T any](first, last iterator.RandomAccessIterator[T], val T, ...) iterator.RandomAccessIterator[T]
- type Ordered
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySearch ¶
func BinarySearch[T any](first, last iterator.RandomAccessIterator[T], val T, cmp comparator.Comparator[T]) bool
BinarySearch returns true if exist an element witch value is val in the range [first, last), or false if not exist
func JoinArrays ¶ added in v1.0.2
func JoinArrays[T Ordered](leftArr []T, rightArr []T) []T
func LowerBound ¶
func LowerBound[T any](first, last iterator.RandomAccessIterator[T], val T, cmp comparator.Comparator[T]) iterator.RandomAccessIterator[T]
LowerBound returns the iterator pointing to the first element greater than or equal to value passed in the range [first, last), or iterator last if not exist.
func MergeSorter ¶ added in v1.0.2
func MergeSorter[T Ordered](array []T) []T
func NextPermutation ¶
func NextPermutation[T any](first, last iterator.RandomAccessIterator[T], cmp comparator.Comparator[T]) bool
NextPermutation transform range [first last) to next permutation,return true if success, or false if failure
func NthElement ¶
func NthElement[T any](first, last iterator.RandomAccessIterator[T], n int, cmp comparator.Comparator[T])
NthElement Rearranges the elements in the range [first,last), in such a way that the element at the nth position is the element that would be in that position in a sorted sequence
func QuickSorter ¶ added in v1.0.2
func Sort ¶
func Sort[T any](first, last iterator.RandomAccessIterator[T], cmp comparator.Comparator[T])
Sort sorts the container by using quick sort
func Stable ¶
func Stable[T any](first, last iterator.RandomAccessIterator[T], cmp comparator.Comparator[T])
Stable sorts the container by using merge sort
func UpperBound ¶
func UpperBound[T any](first, last iterator.RandomAccessIterator[T], val T, cmp comparator.Comparator[T]) iterator.RandomAccessIterator[T]
UpperBound returns the iterator pointing to the first element greater than val in the range [first, last), or iterator last if not exist.