-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit e05b443
authored
merge: Improved the complexity of dequeue O(n) to O(1) (#1005)
* feat: improved memoize function
used Map instead of object & used the JSON.stringfy method for generate a valid string as a key
* docs: modified documentation
* style: format with standard
* docs: modified stringify doc
* refactor: remove two repetition implementation
* feat: added validation, test codes
* chore: remove useless words
* feat: added types for jest
* chore: added link box
* feat: added new validation test casses & methods
* style: formated with standard
* feat: added parse method & test cases
* docs: added js docs
* chore: added default import export
* feat: imporved algorithm via replace method
* test: added two test cases
* feat: added jest type for suggestions
* feat: added `reduceRight` & `trim` method
* chore: added helper variable
* feat: added new rotation option
* Revert "chore: added helper variable"
This reverts commit 489544d.
* remove: yarn lock
* chore: fix grammer
* feat: used replace method & added test case
* feat: remove revert
* chore: added new line
* feat: updated the Queue array to linkedlist DS
* chore: fixed grammer
* resolve: removed capacity related codes, & updated test cases
* feat: added length dicrease code on dequeue1 parent 03d0b1e commit e05b443
2 files changed
+112
-56
lines changedLines changed: 86 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | - | ||
4 | - | ||
5 | - | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
6 | 7 |
| |
7 | 8 |
| |
8 | - | ||
9 | 9 |
| |
10 | - | ||
10 | + | ||
11 | + | ||
11 | 12 |
| |
12 | - | ||
13 | - | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
14 | 18 |
| |
15 | 19 |
| |
16 | - | ||
17 | - | ||
18 | - | ||
19 | - | ||
20 | + | ||
21 | + | ||
20 | 22 |
| |
21 | 23 |
| |
22 | - | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
23 | 47 |
| |
24 | - | ||
48 | + | ||
25 | 49 |
| |
26 | 50 |
| |
27 | 51 |
| |
28 | - | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | ||
29 | 63 |
| |
30 | 64 |
| |
31 | - | ||
32 | - | ||
33 | - | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | ||
34 | 75 |
| |
35 | 76 |
| |
36 | - | ||
37 | - | ||
38 | - | ||
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | ||
39 | 83 |
| |
40 | 84 |
| |
41 | 85 |
| |
42 | - | ||
86 | + | ||
43 | 87 |
| |
44 | 88 |
| |
45 | - | ||
46 | - | ||
47 | - | ||
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | ||
48 | 103 |
| |
49 | 104 |
| |
50 | - | ||
51 | - | ||
52 | - | ||
105 | + | ||
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | ||
53 | 111 |
| |
54 | 112 |
| |
55 | 113 |
| |
56 | - | ||
114 | + |
Lines changed: 26 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | - | ||
1 | + | ||
2 | 2 |
| |
3 | - | ||
4 | - | ||
5 | - | ||
6 | - | ||
7 | - | ||
8 | - | ||
9 | - | ||
3 | + | ||
4 | + | ||
10 | 5 |
| |
11 | - | ||
12 | - | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
13 | 11 |
| |
14 | 12 |
| |
15 | - | ||
16 | - | ||
17 | - | ||
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | ||
13 | + | ||
14 | + | ||
15 | + | ||
22 | 16 |
| |
23 | - | ||
17 | + | ||
18 | + | ||
19 | + | ||
24 | 20 |
| |
25 | 21 |
| |
26 | - | ||
27 | - | ||
22 | + | ||
23 | + | ||
24 | + | ||
28 | 25 |
| |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
33 | 30 |
| |
34 | - | ||
31 | + | ||
32 | + | ||
35 | 33 |
| |
36 | 34 |
| |
37 | - | ||
35 | + | ||
38 | 36 |
| |
39 | - | ||
37 | + | ||
40 | 38 |
| |
41 | 39 |
| |
42 | 40 |
| |
43 | 41 |
| |
44 | 42 |
| |
45 | 43 |
| |
46 | - | ||
44 | + | ||
47 | 45 |
| |
48 | 46 |
|
0 commit comments