Skip to content

Instantly share code, notes, and snippets.

@seanreed1111
Last active December 29, 2015 13:49
Show Gist options
  • Save seanreed1111/7680150 to your computer and use it in GitHub Desktop.
Save seanreed1111/7680150 to your computer and use it in GitHub Desktop.
implementation of class SimpleQueue
class SimpleQueue
def initialize
@queue = Array.new
end
#adds item to back of queue and returns the queue
def enqueue(item)
@queue.unshift(item)
end
#returns and removes item at the front of the queue
def dequeue
@queue.pop
end
def size
@queue.length
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment