collections v0.2.5
Collections
Collections
is a Crystal shard that provides generic data structures like heaps, including:
BinaryHeapMin
: A min-heap implementationBinaryHeapMax
: A max-heap implementation
Installation
Add this to your application's shard.yml
:
dependencies:
collections:
github: Lillevang/collections
version: ~> 0.1.0
Run shards install
Usage
require "collections"
# Min-Heap Example
heap = Collections::BinaryHeapMin(Int32).new
heap.add([10, 20, 5])
puts heap.extract_root! # => 5
# Max-Heap Example
heap = Collections::BinaryHeapMax(Int32).new
heap.add([10, 20, 5])
puts heap.extract_root! # => 20
Development
Write code, good code prefered!
Run tests with: crystal spec
Contributing
- Fork it (https://github.com/Lillevang/collections/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
Released under the MIT License. See LICENSE for details.
Contributors
- Lillevang - creator and maintainer
Repository
collections
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- 4 days ago
- December 16, 2024
License
MIT License
Links
Synced at
Sun, 22 Dec 2024 16:40:57 GMT
Languages