A collection of useful algorithms in Dart with keeping performance and flexibility on mind

algorithmic

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

Usage

The following import will give you access to all algorithms declared in this library.

import 'package:algorithmic/algorithmic.dart';

You can also import these algorithms separately:

Libraries Imports
Search algorithms 'package:algorithmic/searching.dart'

Algorithms

Searching algorithms

Linear Search

Exported Methods 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

Binary Search

Exported Methods Performance Tests Benchmark Since
lowerBound() O(log n) ✔️ ✔️ 0.0.3
lowerBoundBy() O(log n) ✔️ ✔️ 0.0.4
upperBound() O(log n) ✔️ ✔️ 0.0.3
binarySearch() O(log n) ✔️ ✔️ 0.0.3
binarySearchMax() O(log n) ✔️ ✔️ 0.0.3

Benchmarks

All benchmarking files are stored inside the ‘./benchmark’ folder. You can check it directly via the following command:

$ dart run benchmark

You can also check the benchmark.log file for the benchmark result that I got on my PC.

GitHub

View Github