Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Data-Structures/Queue/CircularQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ class CircularQueue {

// Displays the length of queue
length() {
return this.queue.length - 1
if (this.queue.length > 0) {
return this.queue.length - 1
} else {
return 0
}
}

// Display the top most value of queue
Expand Down