bisect 1.0.2

Dart native js
Flutter Android iOS web

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

example/bisect_example.dart

import 'package:bisect/bisect.dart';

void main() {
  /// Get the letter grade of a test based on it's numerical
  /// marks, using the bisect function for numerical lookup
  String grade(num score, {List<num> breakpoints = const [50, 68, 79, 90], grades = 'FDCBA'}){
    var index = breakpoints.bisect(score);
    return grades[index];
  }

  print(grade(87)); // B
}
2
likes
110
pub points
0%
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