Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: f3935b5461
Fetching contributors…

Cannot retrieve contributors at this time

76 lines (51 sloc) 1.56 kB

RData

Code Climate Build Status Dependency Status Coverage Status Gem Version

Purpose

Project goal is to provide a very clear and concise library of datastructures and algorithms in Ruby.

Data Structures

Installation

gem install rdata

Or in a Gemfile

gem 'rdata'

Usage

require 'rdata'

Stacks

Initialization

@stack = RData::Stack.new

Operations

@stack.push(x)     # => Returns 'x'
@stack.pop         # => Returns 'top'
@stack.top         # => Returns 'top'
@stack.is_empty?   # => Returns true/false

More on Stacks

Stacks - Wiki Link

Queues

Initialization

@queue = RData::Queue.new

Operations

@queue.enqueue(9)   # => Returns '9'
@queue.dequeue      # => Returns 'head'
@queue.peek         # => Returns 'head' without removing it
@queue.is_empty?    # => Returns true/false

More on Queues

Coming Soon...

Jump to Line
Something went wrong with that request. Please try again.