Skip to content

Commit 7adf170

Browse files
Update CircularQueue.js
Taking comments into account for refactoring my change.
1 parent 3d68bdc commit 7adf170

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Diff for: Data-Structures/Queue/CircularQueue.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ class CircularQueue {
7777

7878
// Displays the length of queue
7979
length() {
80-
if (this.queue.length > 0) {
81-
return this.queue.length - 1
82-
} else {
83-
return 0
84-
}
80+
return checkEmpty() ? 0 : this.queue.length - 1
8581
}
8682

8783
// Display the top most value of queue

0 commit comments

Comments
 (0)