/js-queue

Queue DataStructure exercise in es6

Primary LanguageJavaScript

The Queue Datastructure

We will be creating a module that helps us generate a Queue Class in the Node environment. A queue is a data structure in which the first element is inserted from one end called REAR (also called tail), and the deletion of existing element takes place from the other end called as FRONT (also called head). This makes queue a FIFO (first in first out), or the element that is inserted first will always be the first to be removed.

Methods

size()

Returns the size of the queue

enqueue(item)

Adds an item to the top of the queue structure

pop()

Takes an item off the top of the queue and returns the item.

peek()

Returns the first item in line to be removed without removing it. If there are no items in the queue, return null

Getting Started

  1. Fork this repository and clone it from your personal GitHub Account
  2. In the Terminal, navigate to the newly created folder for this repository.
  3. Install dependencies by running the command: npm install
  4. Run tests by running the command: npm test
  5. Your work will be one in the file named: lib/Queue.js
  6. Make your tests pass!