Content-Length: 257132 | pFad | http://github.com/ghostcode/JavaScript/commit/314144fae69100c9cf03845434c801f72e4d7714

ED Update CircularQueue.js for zero-length case (#1655) · ghostcode/JavaScript@314144f · GitHub
Skip to content

Commit 314144f

Browse files
Update CircularQueue.js for zero-length case (TheAlgorithms#1655)
* Update CircularQueue.js * Update CircularQueue.js Taking comments into account for refactoring my change. * Update CircularQueue.js Adding "this" to checkEmpty()
1 parent d920e7f commit 314144f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Data-Structures/Queue/CircularQueue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class CircularQueue {
7777

7878
// Displays the length of queue
7979
length() {
80-
return this.queue.length - 1
80+
return this.checkEmpty() ? 0 : this.queue.length - 1
8181
}
8282

8383
// Display the top most value of queue

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/ghostcode/JavaScript/commit/314144fae69100c9cf03845434c801f72e4d7714

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy