diff --git a/Data-Structures/Queue/CircularQueue.js b/Data-Structures/Queue/CircularQueue.js index 27f2196780..c716251668 100644 --- a/Data-Structures/Queue/CircularQueue.js +++ b/Data-Structures/Queue/CircularQueue.js @@ -77,7 +77,7 @@ class CircularQueue { // Displays the length of queue length() { - return this.queue.length - 1 + return this.checkEmpty() ? 0 : this.queue.length - 1 } // Display the top most value of queue