Service enabling sorting for ml-forest (https://github.com/forest-implementation/ml-forest)
First get ruby (e.g. rbenv) and bundler
(Optional) Create your gem
$ bundle gem mygem
Add dependency for the forest
$ bundle add ml-forest --github=forest-implementation/ml-forest
Add dependency for this service
$ bundle add ml-service-sort --github=forest-implementation/ml-service-sort
require "ml/forest"
require "ml/service/sort/quicksort"
forest = Ml::Forest::Tree.new([5, 8, 3, 4, 2, 7] , trees_count: 1, forest_helper: Ml::Service::Sort::QuickSort.new)
sorted_tree = forest.trees.first
pp Ml::Forest::Tree.flat(sorted_tree)
# sorted: [2, 3, 4, 5, 7, 8]
Bug reports and pull requests are welcome on GitHub at https://github.com/forest-implementation/ml-service-sort.