Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fd3ab48

Browse files
fix(queue): runtime error
1 parent 7aa63ff commit fd3ab48

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

‎book/content/part02/queue.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ As an experiment, we can see in the following table that if we had implemented t
7676
|===
7777
.2+.^s| Data Structure 2+^s| Searching By 3+^s| Inserting at the 3+^s| Deleting from .2+.^s| Space
7878
^|_Index/Key_ ^|_Value_ ^|_beginning_ ^|_middle_ ^|_end_ ^|_beginning_ ^|_middle_ ^|_end_
79-
| Queue (w/array) ^|- ^|- ^|- ^|- ^|*O(n)* ^|- ^|- ^|O(1) ^|O(n)
79+
| Queue (w/array) ^|- ^|- ^|- ^|- ^|O(1) ^|*O(n)* ^|- ^|- ^|O(n)
8080
| Queue (w/list) ^|- ^|- ^|- ^|- ^|O(1) ^|- ^|- ^|O(1) ^|O(n)
8181
|===
8282
// end::table[]

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dsa.js",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "Data Structures & Algorithms in JS",
55
"author": "Adrian Mejia <hi+dsajs@adrianmejia.com> (https://adrianmejia.com)",
66
"homepage": "https://github.com/amejiarosario/dsa.js",

‎src/data-structures/queues/queue-1.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Queue {
88

99
/**
1010
* Add element to the queue
11+
* Insert to the end of the array
1112
* Runtime: O(1)
1213
* @param {any} element
1314
*/
@@ -17,7 +18,8 @@ class Queue {
1718

1819
/**
1920
* Add element to the queue
20-
* Runtime: O(1)
21+
* Removing from the beginning of the array
22+
* Runtime: O(n)
2123
* @param {any} element
2224
*/
2325
remove() {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /