Build Status


Useful algorithms such as Sorting Strategies, Searches and Data Structures such as Priority Queues, Symbol Tables, Binary Search Tree BST, Red Black tree RBT, Hash Tables, Bag, Linked List, Deque, Queue (FIFO), Stack (LIFO), Graphs & Graph Traversal strategies for everyday usage.

Algorithms and Data Structures implemented using Ruby, for fun.

Library also contains solutions for several puzzles solved by implemented algorithms and data structures.

Data Structures

  • Bag (primitive collection without ability to delete elements)
  • Singly Linked List
  • Doubly Linked List
  • Deque (double-ended queue)
  • Queue (FIFO)
  • Stack (LIFO)
  • Ordered Symbol Table BST. Implementation using Unbalanced Binary Search Tree.
  • Minimum Priority Queue
  • Maximum Priority Queue
  • Ordered Symbol Table


  • Undirected graph

Graph Traversals

  • Breadth First Search (BFS)
  • Depth First Search (DFS)

Search Algorithms

  • Binary Search

Sorting Algorithms

  • Bubble sort
  • Merge sort
  • Heapsort ( Binary Heap )



  • Shunting-yard algorithm ( Dijkstras two stacks algorithm )
  • Josephus problem


It is always better to check unit tests in order to understand how things going on. Most of the components are encapsulated through the factory methods, so the are could be mixed to other objects.


Add this line to your application's Gemfile:

gem 'algorithmable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install algorithmable


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.