Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kseo/btree
An in-memory B-Tree implementation for Dart
https://github.com/kseo/btree
btree
Last synced: 27 days ago
JSON representation
An in-memory B-Tree implementation for Dart
- Host: GitHub
- URL: https://github.com/kseo/btree
- Owner: kseo
- License: bsd-3-clause
- Created: 2015-11-21T23:29:23.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-03-03T00:32:41.000Z (over 2 years ago)
- Last Synced: 2023-08-20T21:29:20.311Z (about 1 year ago)
- Topics: btree
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/btree
- Size: 13.7 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# btree
This package provides an in-memory B-Tree implementation, useful as a
an ordered, mutable data structure.It has a flatter structure than an equivalent red-black or other binary tree,
which in some cases yields better memory usage and/or performance.The API is based on [BTree implementation for Go][btree-go]
[![Build Status](https://travis-ci.org/kseo/btree.svg)](https://travis-ci.org/kseo/btree)
[![Coverage Status](https://coveralls.io/repos/kseo/btree/badge.svg?branch=master&service=github)](https://coveralls.io/github/kseo/btree?branch=master)[btree-go]: https://godoc.org/github.com/google/btree
## Usage
A simple usage example:
```dart
library btree.example;import 'package:btree/btree.dart';
main() {
final btree = new BTree(3);
for (var i = 0; i < 10; i++) {
btree.replaceOrInsert(i);
}
print('len: ${btree.length}');
// len: 10
print('get3: ${btree[3]}');
// get3: 3
print('get100: ${btree[100]}');
// get100: null
print('del4: ${btree.remove(4)}');
// del4: 4
print('del100: ${btree.remove(100)}');
// del100: null
print('replace5: ${btree.replaceOrInsert(5)}');
// replace5: 5
print('replace100:${btree.replaceOrInsert(100)}');
// replace100:null
print('delmin: ${btree.removeMin()}');
// delmin: 0
print('delmax: ${btree.removeMax()}');
// delmax: 100
print('len: ${btree.length}');
// len: 8
}
```## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/kseo/btree/issues