algorithmic library

A collection of all available 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 sorted list, 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 sorted list. Unlike binarySearch, this does not ensure that the index of the value 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 sorted list, otherwise -1 if not found.
bubbleSort<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare}) → void
Sorts the list of numbers using the bubble sort algorithm.
cocktailShakerSort<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare}) → void
Sorts the list of numbers using the Cocktail shaker sort with a few improvements over the base algorithm.
combSort<E>(List<E> list, {int? begin, int? end, double shrinkFactor = 2.2, Comparator<E>? compare}) → void
Sorts the list of numbers using the Comb sort algorithm.
countingSort(List<int> list, {int? begin, int? end, bool reversed = false}) → void
Sorts a list of integer numbers of small range using the counting sort algorithm.
countingSortOf<E>(List<E> list, KeyOf<E, int> keyOf, {int? begin, int? end, bool reversed = false}) → void
Sorts any list of items using counting sort algorithm.
damerauLevenshteinDistance<E>(List<E> source, List<E> target) int
Finds the Damerau–Levenshtein distance between two lists which allows deletion, insertion, substitution and transposition using Wagner–Fischer algorithm
damerauLevenshteinDistanceOf(String source, String target, {bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Finds the Damerau–Levenshtein distance between two strings which allows deletion, insertion, substitution and transposition using Wagner–Fischer algorithm
diceIndex<E>(List<E> source, List<E> target) double
Finds the Sørensen–Dice coefficient of two list of items.
diceIndexOf(String source, String target, {int ngram = 1, bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) double
Finds the Sørensen–Dice coefficient of two strings.
gnomeSort<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare}) → void
Sorts the list of numbers using the gnome sort algorithm.
hammingDistance<E>(List<E> source, List<E> target, {DualEqualityTest<E, E>? test}) int
Finds the Hamming distance between two lists.
hammingDistanceOf(String source, String target, {bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Finds the Hamming distance between two strings.
insertionSort<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare}) → void
Sorts the list of numbers using the insertion sort algorithm.
jaccardDistance<E>(Iterable<E> source, Iterable<E> target) int
Returns the Jaccard distance between two list of items.
jaccardDistanceOf(String source, String target, {int ngram = 1, bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Returns the Jaccard distance between two strings.
jaccardIndex<E>(List<E> source, List<E> target) double
Returns the Jaccard index between two list of items.
jaccardIndexOf(String source, String target, {int ngram = 1, bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) double
Returns the Jaccard index between two strings.
jaroSimilarity<E>(List<E> source, List<E> target) double
Find the Jaro Similarity index between two list of items.
jaroSimilarityOf(String source, String target, {bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) double
Find the Jaro Similarity index between two strings.
jaroWinklerSimilarity<E>(List<E> source, List<E> target, {int? maxPrefixSize, double? prefixScale, double threshold = 0.7}) double
Find the Jaro-Winkler similarity index between two list of items.
jaroWinklerSimilarityOf(String source, String target, {int? maxPrefixSize, double? prefixScale, double threshold = 0.7, bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) double
Find the Jaro-Winkler Similarity index between two strings.
leeDistance(List<int> source, List<int> target, int q) int
Finds the Lee distance between two lists.
leeDistanceOf(String source, String target, {int q = 1 << 16, KeyOf<String, int>? keyOf, bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Finds the Lee distance between two strings.
levenshteinDistance<E>(List<E> source, List<E> target, {DualEqualityTest<E, E>? test}) int
Finds the Levenshtein distance between two lists which allows deletion, insertion and substitution using Wagner–Fischer algorithm
levenshteinDistanceOf(String source, String target, {bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Finds the Levenshtein distance between two strings which allows deletion, insertion and substitution using Wagner–Fischer algorithm
linearSearch<E>(List<E> list, E value, {int? start, int? count}) int
Returns the first index of the value in the list, 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 the list, otherwise -1.
linearSearchReversed<E>(List<E> list, E value, {int? start, int? count}) int
Returns the last index of the value in a list 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 the list, otherwise -1.
longestCommonSubsequenceLength<E>(List<E> source, List<E> target, {DualEqualityTest<E, E>? test}) int
Returns the length of the longest common subsequence of two list of items.
longestCommonSubsequenceLengthOf(String source, String target, {bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Returns the length of the longest common subsequence of two strings.
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 the value, otherwise if all items are lesser than the value, the length of the list is returned.
mergeSort<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare, int threshold = 8}) → void
Sorts the list of numbers using the merge sort algorithm with a few optimizations.
quickSortHaore<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare, int threshold = 32}) → void
Sorts the list of numbers using the quicksort algorithm following Hoare partition scheme with several optimizations.
quickSortLomuto<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare, int threshold = 32}) → void
Sorts the list of numbers using the quicksort algorithm following Lomuto partition scheme with several optimizations.
radixSort(List<int> list, {int? begin, int? end, bool reversed = false, int? radixPower}) → void
Sorts a list of integer numbers using the radix sort algorithm with a radix value of 2^p.
radixSortOf<E>(List<E> list, KeyOf<E, int> keyOf, {int? begin, int? end, bool reversed = false, int? radixPower}) → void
Sorts any list of items using radix sort algorithm with a radix value of 2^p.
restrictedDamerauDistance<E>(List<E> source, List<E> target, {DualEqualityTest<E, E>? test}) int
Finds the restricted Damerau-Levenshtein edit distance between two lists using Wagner–Fischer algorithm
restrictedDamerauDistanceOf(String source, String target, {bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) int
Finds the restricted Damerau-Levenshtein edit distance between two strings using Wagner–Fischer algorithm
selectionSort<E>(List<E> list, {int? begin, int? end, Comparator<E>? compare}) → void
Sorts the list of numbers using the selection sort algorithm.
tverskyIndex<E>(Iterable<E> source, Iterable<E> target, {double alpha = 0.5, double beta = 0.5}) double
Finds the Tversky similarity index between two lists.
tverskyIndexOf(String source, String target, {int ngram = 1, double alpha = 0.5, double beta = 0.5, bool ignoreCase = false, bool ignoreWhitespace = false, bool ignoreNumbers = false, bool alphaNumericOnly = false}) double
Finds the Tversky similarity index between two strings.
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 the value, otherwise if all items are less than or equal to the value the length of the list is returned.