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
valuein 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
valuein a sortedlist. Unlike binarySearch, this does not ensure that the index of thevalueis 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
valuein 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
valuein thelist, otherwise -1. -
linearSearchBy<
E> (List< E> list, EqualityTest<E> test, {int? start, int? count}) → int -
Returns the first index where the
testis true in thelist, otherwise -1. -
linearSearchReversed<
E> (List< E> list, E value, {int? start, int? count}) → int -
Returns the last index of the
valuein alistin reverse order, otherwise -1. -
linearSearchReversedBy<
E> (List< E> list, EqualityTest<E> test, {int? start, int? count}) → int -
Returns the last index where the
testis 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
listthat is either equal to or greater than the thevalue, otherwise if all items are lesser than thevalue, the length of thelistis 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
listthat is strictly greater than thevalue, otherwise if all items are less than or equal to thevaluethe length of thelistis returned.