searching library
A collection of index search algorithms.
Functions
-
binarySearch<
E, V> (List< E> list, V value, {int? start, int? count, EntryComparator<E, V> ? compare}) → int -
Returns the index of the first occurance of the
value
in a sortedlist
, otherwise -1 if not found. It is ensured that the index is as lowest as possible. -
binarySearchQuick<
E, V> (List< E> list, V value, {int? start, int? count, EntryComparator<E, V> ? compare}) → int -
This function returns the index of the first occurence of a
value
in a sortedlist
. Unlike binarySearch, this does not ensure that the index of thevalue
is as minimum as possible. -
binarySearchUpper<
E, V> (List< E> list, V value, {int? start, int? count, EntryComparator<E, V> ? compare}) → int -
Returns the index of the last occurance of the
value
in a sortedlist
, otherwise -1 if not found. -
linearSearch<
E> (List< E> list, E value, {int? start, int? count}) → int -
Returns the first index of the
value
in thelist
, otherwise -1. -
linearSearchBy<
E> (List< E> list, EqualityTest<E> test, {int? start, int? count}) → int -
Returns the first index where the
test
is true in thelist
, otherwise -1. -
linearSearchReversed<
E> (List< E> list, E value, {int? start, int? count}) → int -
Returns the last index of the
value
in alist
in reverse order, otherwise -1. -
linearSearchReversedBy<
E> (List< E> list, EqualityTest<E> test, {int? start, int? count}) → int -
Returns the last index where the
test
is true in thelist
, otherwise -1. -
lowerBound<
E, V> (List< E> list, V value, {int? start, int? count, EntryComparator<E, V> ? compare}) → int -
Returns the index of the first item from a sorted
list
that is either equal to or greater than the thevalue
, otherwise if all items are lesser than thevalue
, the length of thelist
is returned. -
upperBound<
E, V> (List< E> list, V value, {int? start, int? count, EntryComparator<E, V> ? compare, bool exactMatch = false}) → int -
Returns the index of the first item from a sorted
list
that is strictly greater than thevalue
, otherwise if all items are less than or equal to thevalue
the length of thelist
is returned.