EXERCISE · AlgoCasts

Queue

Create a queue data structure. The queue should be a class with methods 'add' and 'remove'.

4 testsAlgoCastsGPL-3.0exercise 14 of 26

Directions

Directions

Create a queue data structure. The queue should be a class with methods 'add' and 'remove'. Adding to the queue should store an element until it is removed

Examples#

JS
  const q = new Queue();  q.add(1);  q.remove(); // returns 1;

Try it first#

Copy the stub, make the 4 tests pass on your machine, then open the solution. The reveal is remembered per page in this browser.

JSexercises/queue/index.js
class Queue {} module.exports = Queue;

See also