From 3a902b90797fb612851c1bc73bb5c1a1172ca8a6 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 16 Jun 2021 16:14:34 -0500 Subject: [PATCH] added length property to queue and added in the test for it - since it was missing --- implementation/03-queue.js | 3 ++- implementation/test/03-queue-specs.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/implementation/03-queue.js b/implementation/03-queue.js index 18fbe68..00f4f66 100644 --- a/implementation/03-queue.js +++ b/implementation/03-queue.js @@ -5,6 +5,7 @@ class Queue { constructor() { this.head = null; this.tail = null; + this.length = 0; } enqueue(val) { @@ -15,7 +16,7 @@ class Queue { dequeue() { // Remove node from front of queue (linked list) - + // Write your hypothesis on the time complexity of this method here } diff --git a/implementation/test/03-queue-specs.js b/implementation/test/03-queue-specs.js index 7873d84..83fc80f 100644 --- a/implementation/test/03-queue-specs.js +++ b/implementation/test/03-queue-specs.js @@ -37,6 +37,7 @@ describe('Queue', () => { it('Should have head, tail and length properties', () => { expect(queue).to.have.property('head'); expect(queue).to.have.property('tail'); + expect(queue).to.have.property('length'); }); it('Should not implement an Array to store values', () => {