algorithmic 0.0.6 copy "algorithmic: ^0.0.6" to clipboard
algorithmic: ^0.0.6 copied to clipboard

outdated

A collection of useful algorithms keeping performance and flexibility on mind.

algorithmic #

plugin version dependencies Dart

A collection of useful algorithms keeping performance and flexibility on mind.

Usage #

The following import will give you access to all the algorithms in this package.

import 'package:algorithmic/algorithmic.dart';

You can also import these algorithms separately:

Libraries Imported By
Search algorithms 'package:algorithmic/searching.dart'
Sort algorithms 'package:algorithmic/sorting.dart'

Benchmarks #

To run benchmark on your own machine:

$ dart run benchmark

You can check the benchmark.log file for the benchmark results.

Searching algorithms #

Index searching algorithms attempt to find the index of an item from a list.

A faster searching algorithm for sorted list of items. It divides the list into two parts and discard one based on the middle value of them. This requires the list to be sorted in an increasing order.

Functions Performance Tests Benchmark Since
lowerBound() O(log n) ✔️ ✔️ 0.0.3
upperBound() O(log n) ✔️ ✔️ 0.0.3
binarySearch() O(log n) ✔️ ✔️ 0.0.3
binarySearchUpper() O(log n) ✔️ ✔️ 0.0.6
binarySearchQuick() O(log n) ✔️ ✔️ 0.0.6

A general searching algorithm for any kind of list. It tests every elements on the list one by one.

Functions Performance Tests Benchmark Since
linearSearch() O(n) ✔️ ✔️ 0.0.1
linearSearchBy() O(n) ✔️ ✔️ 0.0.4
linearSearchReversed() O(n) ✔️ ✔️ 0.0.1
linearSearchReversedBy() O(n) ✔️ ✔️ 0.0.4

Sorting algorithms #

Sorting algorithms puts a list of items into an increasing order.

Bubble Sort #

Bubble sort performs sorting by repeatedly stepping through the list, comparing adjacent elements and swapping them if they are in the wrong order.

Functions Performance Tests Benchmark Since
bubbleSort() O() ✔️ ✔️ 0.0.5

Selection Sort #

Selection sort algorithm performs sorting by finding the minimum element from the unordered range and putting it at the beginning in each iteration.

Functions Performance Tests Benchmark Since
selectionSort() O() ✔️ ✔️ 0.0.5

Insertion Sort #

Insertion sort sorts splits the list into two parts: the left part is ordered and the right part is unordered. In each iteration, it removes the first item from right part, and insert it into the left part maintaining the increasing order.

Functions Performance Tests Benchmark Since
insertionSort() O() ✔️ ✔️ 0.0.5

Gnome Sort #

Gnome sort is a variation to the insertion sort which uses a much simpler implementation and has O(n) time complexity for an already sorted list.

Functions Performance Tests Benchmark Since
gnomeSort() O() ✔️ ✔️ 0.0.5

Quick Sort #

Quicksort is an in-place sorting algorithm that works by selecting a pivot element and partitioning the list surrounding it. There are several schemes for selecting the pivot. The sorting performance varies for different schemes.

Functions Performance Tests Benchmark Since
quickSortLomuto() O(n log n) ✔️ ✔️ 0.0.6
21
likes
0
points
285
downloads

Publisher

unverified uploader

Weekly Downloads

A collection of useful algorithms keeping performance and flexibility on mind.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on algorithmic