BsTree
An implementation of binary tree, just 4 fun :)
Installation
Add this line to your application's Gemfile:
gem 'bs_tree'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bs_tree
Usage
tree root element:
@root = BsTree::Node.new(5)
and add node:
@root.insert(10)
or
[1, 7, 3, 10, 8].each{|x| @root.insert x }
tree sketch
5
2 7
1 3 10
8
DLR traval:
BsTree::Tree.traval(:dlr, @root)
LRD traval:
BsTree::Tree.traval(:lrd, @root)
Contributing
- Fork it ( http://github.com//bs_tree/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 new Pull Request