Project

ruborithms

0.0
No commit activity in last 3 years
No release in over 3 years
Algorithms and data structures implemented in Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.5
~> 0.48.1
 Project Readme

Ruborithms

Algorithms and data structures implemented on pure Ruby.

Gem Version

Install

gem install ruborithms

Require library:

require 'ruborithms'

Algorithms

Linear Search

Include:

class Array; include Ruborithms::Algorithms::LinearSearch; end

Linear search can now be used as a class singleton method:

irb(main):006:0> Array.linear_search([1, 55, 22, 44], 55)
=> 1

Or in the instance context:

irb(main):007:0> [1, 55, 22, 44].linear_search(55)
=> 1

Binary Search

Include:

class Array; include Ruborithms::Algorithms::BinarySearch; end  

Binary search can now be used as a class singleton method:

irb(main):008:0> Array.binary_search([1, 55, 22, 44], 55)
=> 1

Or in the instance context:

irb(main):009:0> [1, 55, 22, 44].binary_search(55)
=> 1

Selection Sort

Include:

class Array; include Ruborithms::Algorithms::SelectionSort; end  

Binary search can now be used as a class singleton method:

irb(main):017:0> Array.selection_sort([1, 55, 22, 44])
=> [1, 22, 44, 55]

Or in the instance context:

irb(main):019:0> [1, 55, 22, 44].selection_sort
=> [1, 22, 44, 55]