bisect 1.0.2

Dart native js
Flutter Android iOS web

A library that implements a simple bisection algorithm for insertion in sorted lists.

Array bisection algorithm for Dart.

Simple array bisection algorithm translated from Python's default library and implemented as extension methods for the class.

These methods are used to insert an element in a sorted list, without needing to sort it again.

Usage #

A simple usage example:

import 'package:bisect/bisect.dart';

main() {
  final sortedList = [1, 3, 4, 6, 8, 23, 75];

  // Get the index where to insert an element
  final index = sortedList.bisect(7);
  print(index); // 4

  // Inserts an element to the list while keeping sorting
  sortedList.insort(7);
  print(sortedList); // [1, 3, 4, 6, 7, 8, 23, 75]

Features and bugs #

Please file feature requests and bugs at the issue tracker.

2
likes
110
pub points
28%
popularity

A library that implements a simple bisection algorithm for insertion in sorted lists.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

israel.silvino@gmail.com

License

MIT (LICENSE)

More

Packages that depend on bisect