bisect 1.0.0 copy "bisect: ^1.0.0" to clipboard
bisect: ^1.0.0 copied to clipboard

outdated

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.

4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on bisect