enqueue
method that pushes an element to the tail of the queue, a dequeue
method that removes and returns the front element, a front
method that lets us see the front element, a size
method that shows the length, and an isEmpty
method to check if the queue is empty.
Queue
class should have a enqueue
method.
testString: assert((function(){var test = new Queue(); return (typeof test.enqueue === 'function')}()));
- text: Your Queue
class should have a dequeue
method.
testString: assert((function(){var test = new Queue(); return (typeof test.dequeue === 'function')}()));
- text: Your Queue
class should have a front
method.
testString: assert((function(){var test = new Queue(); return (typeof test.front === 'function')}()));
- text: Your Queue
class should have a size
method.
testString: assert((function(){var test = new Queue(); return (typeof test.size === 'function')}()));
- text: Your Queue
class should have an isEmpty
method.
testString: assert((function(){var test = new Queue(); return (typeof test.isEmpty === 'function')}()));
- text: The dequeue
method should remove and return the front element of the queue
testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); test.enqueue('John'); return (test.dequeue() === 'Smith')}()));
- text: The front
method should return value of the front element of the queue
testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); test.enqueue('John'); return (test.front() === 'Smith')}()));
- text: The size
method should return the length of the queue
testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); return (test.size() === 1)}()));
- text: The isEmpty
method should return false
if there are elements in the queue
testString: assert((function(){var test = new Queue(); test.enqueue('Smith'); return !(test.isEmpty())}()));
```