flat_tree

Version, currently 0.1.13 versions

github.com/dukenguyenxyz/flat_tree

Map a binary tree to a vector

6 stars
0 dependents
License: MIT

Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  flat_tree:
    github: dukenguyenxyz/flat_tree
    version: ~> 0.1.1

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.1. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

flat_tree

Build Status Docs GitHub release (latest by date)

Map a binary tree to a vector. Port of mafintosh/flat-tree

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      flat_tree:
        github: dukeraphaelng/flat_tree
  2. Run shards install

Usage

You can represent a binary tree in a simple flat list using the following structure

      3
  1       5
0   2   4   6  ...

This module exposes a series of functions to help you build and maintain this data structure

require "flat_tree"

list = [] of String

i = FlatTree.index(0_u64, 0_u64) # get array index for depth: 0, offset: 0
j = FlatTree.index(1_u64, 0_u64) # get array index for depth: 1, offset: 0

# use these indexes to store some data

list[i] = 'a'
list[j] = 'b'
list[FlatTree.parent(i)] = 'parent of a and b'

Contributing

  1. Fork it (https://github.com/dukeraphaelng/flat_tree/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  1. Push to the branch (git push origin my-new-feature)
  2. Create a new Pull Request

Contributors

License