data-structure-typed 1.47.6 → 1.47.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +10 -7
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/release-package.yml +1 -1
- package/CHANGELOG.md +1 -1
- package/CODE_OF_CONDUCT.md +32 -10
- package/COMMANDS.md +3 -1
- package/CONTRIBUTING.md +4 -3
- package/README.md +188 -32
- package/SECURITY.md +1 -1
- package/benchmark/report.html +46 -1
- package/benchmark/report.json +563 -8
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +40 -22
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +45 -36
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +105 -113
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +133 -119
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +53 -44
- package/dist/cjs/data-structures/binary-tree/bst.js +137 -154
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +48 -15
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +70 -33
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/segment-tree.d.ts +6 -6
- package/dist/cjs/data-structures/binary-tree/segment-tree.js +7 -7
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +26 -37
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js +58 -137
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +17 -17
- package/dist/cjs/data-structures/graph/abstract-graph.js +30 -30
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +24 -24
- package/dist/cjs/data-structures/graph/directed-graph.js +28 -28
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -1
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +14 -14
- package/dist/cjs/data-structures/graph/undirected-graph.js +18 -18
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -1
- package/dist/cjs/data-structures/hash/hash-map.d.ts +2 -6
- package/dist/cjs/data-structures/hash/hash-map.js +5 -8
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +28 -28
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +33 -33
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +21 -21
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +27 -27
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +4 -4
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +13 -13
- package/dist/cjs/data-structures/queue/queue.js +13 -13
- package/dist/cjs/data-structures/stack/stack.d.ts +6 -6
- package/dist/cjs/data-structures/stack/stack.js +7 -7
- package/dist/cjs/data-structures/stack/stack.js.map +1 -1
- package/dist/cjs/data-structures/trie/trie.d.ts +3 -0
- package/dist/cjs/data-structures/trie/trie.js +19 -4
- package/dist/cjs/data-structures/trie/trie.js.map +1 -1
- package/dist/cjs/interfaces/binary-tree.d.ts +3 -3
- package/dist/cjs/types/common.d.ts +6 -1
- package/dist/cjs/types/data-structures/graph/abstract-graph.d.ts +2 -2
- package/dist/cjs/types/data-structures/hash/hash-map.d.ts +1 -2
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +40 -22
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +45 -36
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +105 -113
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +133 -128
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +53 -44
- package/dist/mjs/data-structures/binary-tree/bst.js +137 -154
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +48 -15
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +70 -33
- package/dist/mjs/data-structures/binary-tree/segment-tree.d.ts +6 -6
- package/dist/mjs/data-structures/binary-tree/segment-tree.js +7 -7
- package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +26 -37
- package/dist/mjs/data-structures/binary-tree/tree-multimap.js +59 -138
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +17 -17
- package/dist/mjs/data-structures/graph/abstract-graph.js +30 -30
- package/dist/mjs/data-structures/graph/directed-graph.d.ts +24 -24
- package/dist/mjs/data-structures/graph/directed-graph.js +28 -28
- package/dist/mjs/data-structures/graph/undirected-graph.d.ts +14 -14
- package/dist/mjs/data-structures/graph/undirected-graph.js +18 -18
- package/dist/mjs/data-structures/hash/hash-map.d.ts +2 -6
- package/dist/mjs/data-structures/hash/hash-map.js +5 -8
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +28 -28
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +33 -33
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +21 -21
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +27 -27
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +4 -4
- package/dist/mjs/data-structures/queue/queue.d.ts +13 -13
- package/dist/mjs/data-structures/queue/queue.js +13 -13
- package/dist/mjs/data-structures/stack/stack.d.ts +6 -6
- package/dist/mjs/data-structures/stack/stack.js +7 -7
- package/dist/mjs/data-structures/trie/trie.d.ts +3 -0
- package/dist/mjs/data-structures/trie/trie.js +20 -4
- package/dist/mjs/interfaces/binary-tree.d.ts +3 -3
- package/dist/mjs/types/common.d.ts +6 -1
- package/dist/mjs/types/data-structures/graph/abstract-graph.d.ts +2 -2
- package/dist/mjs/types/data-structures/hash/hash-map.d.ts +1 -2
- package/dist/umd/data-structure-typed.js +583 -627
- package/dist/umd/data-structure-typed.min.js +2 -2
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +1 -1
- package/src/data-structures/binary-tree/avl-tree.ts +59 -39
- package/src/data-structures/binary-tree/binary-tree.ts +192 -180
- package/src/data-structures/binary-tree/bst.ts +157 -154
- package/src/data-structures/binary-tree/rb-tree.ts +78 -37
- package/src/data-structures/binary-tree/segment-tree.ts +10 -10
- package/src/data-structures/binary-tree/tree-multimap.ts +67 -145
- package/src/data-structures/graph/abstract-graph.ts +46 -46
- package/src/data-structures/graph/directed-graph.ts +40 -40
- package/src/data-structures/graph/undirected-graph.ts +26 -26
- package/src/data-structures/hash/hash-map.ts +8 -8
- package/src/data-structures/linked-list/doubly-linked-list.ts +45 -45
- package/src/data-structures/linked-list/singly-linked-list.ts +38 -38
- package/src/data-structures/linked-list/skip-linked-list.ts +4 -4
- package/src/data-structures/queue/queue.ts +13 -13
- package/src/data-structures/stack/stack.ts +9 -9
- package/src/data-structures/trie/trie.ts +23 -4
- package/src/interfaces/binary-tree.ts +3 -3
- package/src/types/common.ts +11 -1
- package/src/types/data-structures/graph/abstract-graph.ts +2 -2
- package/src/types/data-structures/hash/hash-map.ts +1 -2
- package/test/integration/{all-in-one.ts → all-in-one.test.ts} +1 -1
- package/test/integration/index.html +158 -2
- package/test/performance/data-structures/comparison/comparison.test.ts +5 -5
- package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +1 -1
- package/test/performance/data-structures/linked-list/singly-linked-list.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +19 -19
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +50 -51
- package/test/unit/data-structures/binary-tree/bst.test.ts +49 -54
- package/test/unit/data-structures/binary-tree/overall.test.ts +17 -18
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +3 -3
- package/test/unit/data-structures/binary-tree/segment-tree.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/tree-multimap.test.ts +118 -66
- package/test/unit/data-structures/graph/abstract-graph.test.ts +4 -4
- package/test/unit/data-structures/graph/directed-graph.test.ts +10 -10
- package/test/unit/data-structures/graph/undirected-graph.test.ts +3 -3
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +14 -14
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +3 -3
- package/test/unit/data-structures/linked-list/skip-list.test.ts +1 -1
- package/test/unit/data-structures/queue/deque.test.ts +1 -1
- package/test/unit/data-structures/stack/stack.test.ts +2 -2
- package/test/unit/unrestricted-interconversion.test.ts +61 -5
- package/tsconfig-cjs.json +1 -1
|
@@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
|
|
|
12
12
|
|
|
13
13
|
**To Reproduce**
|
|
14
14
|
Steps to reproduce the behavior:
|
|
15
|
+
|
|
15
16
|
1. Go to '...'
|
|
16
17
|
2. Click on '....'
|
|
17
18
|
3. Scroll down to '....'
|
|
@@ -24,15 +25,17 @@ A clear and concise description of what you expected to happen.
|
|
|
24
25
|
If applicable, add screenshots to help explain your problem.
|
|
25
26
|
|
|
26
27
|
**Desktop (please complete the following information):**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
|
|
29
|
+
- OS: [e.g. iOS]
|
|
30
|
+
- Browser [e.g. chrome, safari]
|
|
31
|
+
- Version [e.g. 22]
|
|
30
32
|
|
|
31
33
|
**Smartphone (please complete the following information):**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
- Device: [e.g. iPhone6]
|
|
36
|
+
- OS: [e.g. iOS8.1]
|
|
37
|
+
- Browser [e.g. stock browser, safari]
|
|
38
|
+
- Version [e.g. 22]
|
|
36
39
|
|
|
37
40
|
**Additional context**
|
|
38
41
|
Add any other context about the problem here.
|
package/.github/workflows/ci.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
|
10
10
|
|
|
11
|
-
## [v1.47.
|
|
11
|
+
## [v1.47.8](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
### Changes
|
|
14
14
|
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Our Commitment
|
|
4
4
|
|
|
5
|
-
We, as members, contributors, and leaders, solemnly pledge to ensure that participation in our community is an
|
|
5
|
+
We, as members, contributors, and leaders, solemnly pledge to ensure that participation in our community is an
|
|
6
|
+
experience free from harassment for everyone, regardless of their age, body size, visible or invisible disabilities,
|
|
7
|
+
ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status,
|
|
8
|
+
nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
9
|
|
|
7
10
|
We commit to engaging in behaviors that foster an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
11
|
|
|
@@ -26,55 +29,74 @@ Unacceptable behaviors include:
|
|
|
26
29
|
|
|
27
30
|
## Enforcement Responsibilities
|
|
28
31
|
|
|
29
|
-
Community leaders bear the responsibility of clarifying and enforcing our standards of acceptable behavior. They will
|
|
32
|
+
Community leaders bear the responsibility of clarifying and enforcing our standards of acceptable behavior. They will
|
|
33
|
+
take fair and appropriate corrective actions in response to any behavior they deem inappropriate, threatening,
|
|
34
|
+
offensive, or harmful.
|
|
30
35
|
|
|
31
|
-
Community leaders have the authority and duty to remove, edit, or reject comments, commits, code, wiki edits, issues,
|
|
36
|
+
Community leaders have the authority and duty to remove, edit, or reject comments, commits, code, wiki edits, issues,
|
|
37
|
+
and other contributions that do not align with this Code of Conduct. They will communicate the reasons for moderation
|
|
38
|
+
decisions when deemed necessary.
|
|
32
39
|
|
|
33
40
|
## Scope
|
|
34
41
|
|
|
35
|
-
This Code of Conduct is applicable in all community spaces and extends to instances when an individual officially
|
|
42
|
+
This Code of Conduct is applicable in all community spaces and extends to instances when an individual officially
|
|
43
|
+
represents the community in public spaces. Examples of representing our community include using an official email
|
|
44
|
+
address, posting through an official social media account, or acting as an appointed representative at an online or
|
|
45
|
+
offline event.
|
|
36
46
|
|
|
37
47
|
## Enforcement
|
|
38
48
|
|
|
39
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
|
|
49
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
|
|
50
|
+
for enforcement at zrwusa@gmail.com. All complaints will be promptly and fairly reviewed and investigated.
|
|
40
51
|
|
|
41
52
|
All community leaders are obligated to uphold the privacy and security of the reporter of any incident.
|
|
42
53
|
|
|
43
54
|
## Enforcement Guidelines
|
|
44
55
|
|
|
45
|
-
Community leaders will adhere to these Community Impact Guidelines when determining consequences for actions that
|
|
56
|
+
Community leaders will adhere to these Community Impact Guidelines when determining consequences for actions that
|
|
57
|
+
violate this Code of Conduct:
|
|
46
58
|
|
|
47
59
|
### Correction
|
|
48
60
|
|
|
49
61
|
Community Impact: The use of inappropriate language or other unprofessional or unwelcome behavior within the community.
|
|
50
62
|
|
|
51
|
-
Consequence: A private, written warning from community leaders, providing clarity regarding the nature of the violation
|
|
63
|
+
Consequence: A private, written warning from community leaders, providing clarity regarding the nature of the violation
|
|
64
|
+
and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
65
|
|
|
53
66
|
### Warning
|
|
54
67
|
|
|
55
68
|
Community Impact: A violation through a single incident or a series of actions.
|
|
56
69
|
|
|
57
|
-
Consequence: A warning with consequences for continued behavior. No interaction with the individuals involved, including
|
|
70
|
+
Consequence: A warning with consequences for continued behavior. No interaction with the individuals involved, including
|
|
71
|
+
unsolicited interaction with those enforcing the Code of Conduct, is allowed for a specified period of time. This
|
|
72
|
+
includes refraining from interactions in community spaces as well as external channels like social media. Violating
|
|
73
|
+
these terms may result in a temporary or permanent ban.
|
|
58
74
|
|
|
59
75
|
### Temporary Ban
|
|
60
76
|
|
|
61
77
|
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
78
|
|
|
63
|
-
Consequence: A temporary ban from any form of interaction or public communication with the community for a specified
|
|
79
|
+
Consequence: A temporary ban from any form of interaction or public communication with the community for a specified
|
|
80
|
+
period. No public or private interaction with the individuals involved, including unsolicited interaction with those
|
|
81
|
+
enforcing the Code of Conduct, is permitted during this time. Violating these terms may lead to a permanent ban.
|
|
64
82
|
|
|
65
83
|
### Permanent Ban
|
|
66
84
|
|
|
67
|
-
Community Impact: Demonstrating a pattern of violating community standards, including sustained inappropriate behavior,
|
|
85
|
+
Community Impact: Demonstrating a pattern of violating community standards, including sustained inappropriate behavior,
|
|
86
|
+
harassment of an individual, or aggression towards or disparagement of classes of individuals.
|
|
68
87
|
|
|
69
88
|
Consequence: A permanent ban from any form of public interaction within the community.
|
|
70
89
|
|
|
71
90
|
[//]: # (## Attribution)
|
|
72
91
|
|
|
73
92
|
[//]: # ()
|
|
93
|
+
|
|
74
94
|
[//]: # (The Community Impact Guidelines drew inspiration from Mozilla's code of conduct enforcement ladder.)
|
|
75
95
|
|
|
76
96
|
[//]: # ()
|
|
97
|
+
|
|
77
98
|
[//]: # (For answers to common questions about this code of conduct, please refer to the FAQ at https://www.zrwusa.org/faq.)
|
|
78
99
|
|
|
79
100
|
[//]: # ()
|
|
101
|
+
|
|
80
102
|
[//]: # (Translations are available at https://www.zrwusa.org/translations.)
|
package/COMMANDS.md
CHANGED
|
@@ -4,7 +4,8 @@ Overview of the commands to test, run and build this project as well as those th
|
|
|
4
4
|
|
|
5
5
|
## Most important commands for development
|
|
6
6
|
|
|
7
|
-
- `npm install` Installs all dependencies and creates the folder `node_modules`, that is needed for all following
|
|
7
|
+
- `npm install` Installs all dependencies and creates the folder `node_modules`, that is needed for all following
|
|
8
|
+
commands.
|
|
8
9
|
- `npm run lint` Lint src/ and test/ codebase (using ESLint)
|
|
9
10
|
- `npm run format` Pretty src/ and test/ codebase (using Prettier)
|
|
10
11
|
- `npm run inspect` Check src/ and test/ codebase (using TSC and ESLint)
|
|
@@ -18,6 +19,7 @@ Overview of the commands to test, run and build this project as well as those th
|
|
|
18
19
|
- `npm run test:perf -- priority-queue.test` Run specific performance test
|
|
19
20
|
|
|
20
21
|
[//]: # (- `npm run coverage-badge` Updates code coverage badge inside `README.md`)
|
|
22
|
+
|
|
21
23
|
- `npm run build:docs` Generates JSDoc Documentation in folder "docs"
|
|
22
24
|
- `npm run build` Build the application for production including es6(ESModule), es5(CommonJS) and minification(UMD)
|
|
23
25
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -68,9 +68,10 @@
|
|
|
68
68
|
|
|
69
69
|
**Contributing new features**
|
|
70
70
|
|
|
71
|
-
- To ensure that there are no conflicts when merging the branch into the main branch,
|
|
72
|
-
- it is necessary to perform the following steps each time new development is going to be conducted on non-main
|
|
73
|
-
|
|
71
|
+
- To ensure that there are no conflicts when merging the branch into the main branch,
|
|
72
|
+
- it is necessary to perform the following steps each time new development is going to be conducted on non-main
|
|
73
|
+
branches:
|
|
74
|
+
- `git pull`,
|
|
74
75
|
- `git rebase main`
|
|
75
76
|
- resolve conflicts before continuing the development.
|
|
76
77
|
- After new features developed
|
package/README.md
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
Data Structures of Javascript & TypeScript.
|
|
13
13
|
|
|
14
|
-
Do you envy C++ with [STL]() (std::), Python with [collections](), and Java with [java.util]() ? Well, no need to envy
|
|
14
|
+
Do you envy C++ with [STL]() (std::), Python with [collections](), and Java with [java.util]() ? Well, no need to envy
|
|
15
|
+
anymore! JavaScript and TypeScript now have [data-structure-typed]().
|
|
15
16
|
|
|
16
17
|
Now you can use this in Node.js and browser environments
|
|
17
18
|
|
|
18
|
-
CommonJS:**`require export.modules =`**
|
|
19
|
+
CommonJS:**`require export.modules =`**
|
|
19
20
|
|
|
20
21
|
ESModule: **`import export`**
|
|
21
22
|
|
|
@@ -59,16 +60,19 @@ import {
|
|
|
59
60
|
Copy the line below into the head tag in an HTML document.
|
|
60
61
|
|
|
61
62
|
#### development
|
|
63
|
+
|
|
62
64
|
```html
|
|
63
65
|
<script src='https://cdn.jsdelivr.net/npm/data-structure-typed/dist/umd/data-structure-typed.js'></script>
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
#### production
|
|
69
|
+
|
|
67
70
|
```html
|
|
68
71
|
<script src='https://cdn.jsdelivr.net/npm/data-structure-typed/dist/umd/data-structure-typed.min.js'></script>
|
|
69
72
|
```
|
|
70
73
|
|
|
71
74
|
Copy the code below into the script tag of your HTML, and you're good to go with your development.
|
|
75
|
+
|
|
72
76
|
```js
|
|
73
77
|
const {Heap} = dataStructureTyped;
|
|
74
78
|
const {
|
|
@@ -81,45 +85,44 @@ const {
|
|
|
81
85
|
## Vivid Examples
|
|
82
86
|
|
|
83
87
|
### Binary Tree
|
|
84
|
-
[Try it out](https://vivid-algorithm.vercel.app/), or you can run your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
85
|
-
|
|
86
|
-

|
|
87
88
|
|
|
89
|
+
[Try it out](https://vivid-algorithm.vercel.app/), or you can run your own code using
|
|
90
|
+
our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
88
91
|
|
|
92
|
+

|
|
89
93
|
|
|
90
94
|
### Binary Tree DFS
|
|
95
|
+
|
|
91
96
|
[Try it out](https://vivid-algorithm.vercel.app/)
|
|
92
97
|
|
|
93
98
|

|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
|
|
97
100
|
### AVL Tree
|
|
101
|
+
|
|
98
102
|
[Try it out](https://vivid-algorithm.vercel.app/)
|
|
99
103
|
|
|
100
104
|

|
|
101
105
|
|
|
102
|
-
|
|
103
106
|
### Tree Multi Map
|
|
107
|
+
|
|
104
108
|
[Try it out](https://vivid-algorithm.vercel.app/)
|
|
105
109
|
|
|
106
110
|

|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
112
|
### Matrix
|
|
113
|
+
|
|
111
114
|
[Try it out](https://vivid-algorithm.vercel.app/algorithm/graph/)
|
|
112
115
|
|
|
113
116
|

|
|
114
117
|
|
|
115
|
-
|
|
116
118
|
### Directed Graph
|
|
119
|
+
|
|
117
120
|
[Try it out](https://vivid-algorithm.vercel.app/algorithm/graph/)
|
|
118
121
|
|
|
119
122
|

|
|
120
123
|
|
|
121
|
-
|
|
122
124
|
### Map Graph
|
|
125
|
+
|
|
123
126
|
[Try it out](https://vivid-algorithm.vercel.app/algorithm/graph/)
|
|
124
127
|
|
|
125
128
|

|
|
@@ -293,6 +296,158 @@ graph.addEdge('B', 'D');
|
|
|
293
296
|
|
|
294
297
|
const dijkstraResult = graph.dijkstra('A');
|
|
295
298
|
Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', 'D']
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Free conversion between data structures.
|
|
304
|
+
|
|
305
|
+
```js
|
|
306
|
+
const orgArr = [6, 1, 2, 7, 5, 3, 4, 9, 8];
|
|
307
|
+
const orgStrArr = ["trie", "trial", "trick", "trip", "tree", "trend", "triangle", "track", "trace", "transmit"];
|
|
308
|
+
const entries = [[6, 6], [1, 1], [2, 2], [7, 7], [5, 5], [3, 3], [4, 4], [9, 9], [8, 8]];
|
|
309
|
+
|
|
310
|
+
const queue = new Queue(orgArr);
|
|
311
|
+
queue.print();
|
|
312
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
313
|
+
|
|
314
|
+
const deque = new Deque(orgArr);
|
|
315
|
+
deque.print();
|
|
316
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
317
|
+
|
|
318
|
+
const sList = new SinglyLinkedList(orgArr);
|
|
319
|
+
sList.print();
|
|
320
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
321
|
+
|
|
322
|
+
const dList = new DoublyLinkedList(orgArr);
|
|
323
|
+
dList.print();
|
|
324
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
325
|
+
|
|
326
|
+
const stack = new Stack(orgArr);
|
|
327
|
+
stack.print();
|
|
328
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
329
|
+
|
|
330
|
+
const minHeap = new MinHeap(orgArr);
|
|
331
|
+
minHeap.print();
|
|
332
|
+
// [1, 5, 2, 7, 6, 3, 4, 9, 8]
|
|
333
|
+
|
|
334
|
+
const maxPQ = new MaxPriorityQueue(orgArr);
|
|
335
|
+
maxPQ.print();
|
|
336
|
+
// [9, 8, 4, 7, 5, 2, 3, 1, 6]
|
|
337
|
+
|
|
338
|
+
const biTree = new BinaryTree(entries);
|
|
339
|
+
biTree.print();
|
|
340
|
+
// ___6___
|
|
341
|
+
// / \
|
|
342
|
+
// ___1_ _2_
|
|
343
|
+
// / \ / \
|
|
344
|
+
// _7_ 5 3 4
|
|
345
|
+
// / \
|
|
346
|
+
// 9 8
|
|
347
|
+
|
|
348
|
+
const bst = new BST(entries);
|
|
349
|
+
bst.print();
|
|
350
|
+
// _____5___
|
|
351
|
+
// / \
|
|
352
|
+
// _2_ _7_
|
|
353
|
+
// / \ / \
|
|
354
|
+
// 1 3_ 6 8_
|
|
355
|
+
// \ \
|
|
356
|
+
// 4 9
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
const rbTree = new RedBlackTree(entries);
|
|
360
|
+
rbTree.print();
|
|
361
|
+
// ___4___
|
|
362
|
+
// / \
|
|
363
|
+
// _2_ _6___
|
|
364
|
+
// / \ / \
|
|
365
|
+
// 1 3 5 _8_
|
|
366
|
+
// / \
|
|
367
|
+
// 7 9
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
const avl = new AVLTree(entries);
|
|
371
|
+
avl.print();
|
|
372
|
+
// ___4___
|
|
373
|
+
// / \
|
|
374
|
+
// _2_ _6___
|
|
375
|
+
// / \ / \
|
|
376
|
+
// 1 3 5 _8_
|
|
377
|
+
// / \
|
|
378
|
+
// 7 9
|
|
379
|
+
|
|
380
|
+
const treeMulti = new TreeMultimap(entries);
|
|
381
|
+
treeMulti.print();
|
|
382
|
+
// ___4___
|
|
383
|
+
// / \
|
|
384
|
+
// _2_ _6___
|
|
385
|
+
// / \ / \
|
|
386
|
+
// 1 3 5 _8_
|
|
387
|
+
// / \
|
|
388
|
+
// 7 9
|
|
389
|
+
|
|
390
|
+
const hm = new HashMap(entries);
|
|
391
|
+
hm.print()
|
|
392
|
+
// [[6, 6], [1, 1], [2, 2], [7, 7], [5, 5], [3, 3], [4, 4], [9, 9], [8, 8]]
|
|
393
|
+
|
|
394
|
+
const rbTreeH = new RedBlackTree(hm);
|
|
395
|
+
rbTreeH.print();
|
|
396
|
+
// ___4___
|
|
397
|
+
// / \
|
|
398
|
+
// _2_ _6___
|
|
399
|
+
// / \ / \
|
|
400
|
+
// 1 3 5 _8_
|
|
401
|
+
// / \
|
|
402
|
+
// 7 9
|
|
403
|
+
|
|
404
|
+
const pq = new MinPriorityQueue(orgArr);
|
|
405
|
+
pq.print();
|
|
406
|
+
// [1, 5, 2, 7, 6, 3, 4, 9, 8]
|
|
407
|
+
|
|
408
|
+
const bst1 = new BST(pq);
|
|
409
|
+
bst1.print();
|
|
410
|
+
// _____5___
|
|
411
|
+
// / \
|
|
412
|
+
// _2_ _7_
|
|
413
|
+
// / \ / \
|
|
414
|
+
// 1 3_ 6 8_
|
|
415
|
+
// \ \
|
|
416
|
+
// 4 9
|
|
417
|
+
|
|
418
|
+
const dq1 = new Deque(orgArr);
|
|
419
|
+
dq1.print();
|
|
420
|
+
// [6, 1, 2, 7, 5, 3, 4, 9, 8]
|
|
421
|
+
const rbTree1 = new RedBlackTree(dq1);
|
|
422
|
+
rbTree1.print();
|
|
423
|
+
// _____5___
|
|
424
|
+
// / \
|
|
425
|
+
// _2___ _7___
|
|
426
|
+
// / \ / \
|
|
427
|
+
// 1 _4 6 _9
|
|
428
|
+
// / /
|
|
429
|
+
// 3 8
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
const trie2 = new Trie(orgStrArr);
|
|
433
|
+
trie2.print();
|
|
434
|
+
// ['trie', 'trial', 'triangle', 'trick', 'trip', 'tree', 'trend', 'track', 'trace', 'transmit']
|
|
435
|
+
const heap2 = new Heap(trie2, { comparator: (a, b) => Number(a) - Number(b) });
|
|
436
|
+
heap2.print();
|
|
437
|
+
// ['transmit', 'trace', 'tree', 'trend', 'track', 'trial', 'trip', 'trie', 'trick', 'triangle']
|
|
438
|
+
const dq2 = new Deque(heap2);
|
|
439
|
+
dq2.print();
|
|
440
|
+
// ['transmit', 'trace', 'tree', 'trend', 'track', 'trial', 'trip', 'trie', 'trick', 'triangle']
|
|
441
|
+
const entries2 = dq2.map((el, i) => [i, el]);
|
|
442
|
+
const avl2 = new AVLTree(entries2);
|
|
443
|
+
avl2.print();
|
|
444
|
+
// ___3_______
|
|
445
|
+
// / \
|
|
446
|
+
// _1_ ___7_
|
|
447
|
+
// / \ / \
|
|
448
|
+
// 0 2 _5_ 8_
|
|
449
|
+
// / \ \
|
|
450
|
+
// 4 6 9
|
|
296
451
|
```
|
|
297
452
|
|
|
298
453
|
## API docs & Examples
|
|
@@ -305,7 +460,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
305
460
|
|
|
306
461
|
## Data Structures
|
|
307
462
|
|
|
308
|
-
<table>
|
|
463
|
+
<table style="display: table; width:100%; table-layout: fixed;">
|
|
309
464
|
<thead>
|
|
310
465
|
<tr>
|
|
311
466
|
<th>Data Structure</th>
|
|
@@ -446,7 +601,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
446
601
|
|
|
447
602
|
## Standard library data structure comparison
|
|
448
603
|
|
|
449
|
-
<table>
|
|
604
|
+
<table style="display: table; width:100%; table-layout: fixed;">
|
|
450
605
|
<thead>
|
|
451
606
|
<tr>
|
|
452
607
|
<th>Data Structure Typed</th>
|
|
@@ -626,59 +781,59 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
626
781
|
[//]: # (No deletion!!! Start of Replace Section)
|
|
627
782
|
<div class="json-to-html-collapse clearfix 0">
|
|
628
783
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
629
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>
|
|
784
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>33.09</td><td>30.22</td><td>4.32e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>74.12</td><td>13.49</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>41.71</td><td>23.97</td><td>0.00</td></tr><tr><td>10,000 get</td><td>28.37</td><td>35.25</td><td>2.37e-4</td></tr></table></div>
|
|
630
785
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
631
786
|
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
|
632
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>
|
|
787
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 add randomly</td><td>14.50</td><td>68.96</td><td>1.33e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>16.20</td><td>61.72</td><td>2.03e-4</td></tr><tr><td>1,000 addMany</td><td>10.51</td><td>95.12</td><td>8.76e-5</td></tr><tr><td>1,000 get</td><td>18.28</td><td>54.69</td><td>1.82e-4</td></tr><tr><td>1,000 dfs</td><td>157.23</td><td>6.36</td><td>7.06e-4</td></tr><tr><td>1,000 bfs</td><td>58.06</td><td>17.22</td><td>0.01</td></tr><tr><td>1,000 morris</td><td>256.36</td><td>3.90</td><td>0.00</td></tr></table></div>
|
|
633
788
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
634
789
|
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
635
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>
|
|
790
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 add randomly</td><td>30.48</td><td>32.81</td><td>4.13e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>71.84</td><td>13.92</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>29.54</td><td>33.85</td><td>5.25e-4</td></tr><tr><td>10,000 get</td><td>30.53</td><td>32.75</td><td>0.01</td></tr></table></div>
|
|
636
791
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
637
792
|
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
638
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add</td><td>
|
|
793
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add</td><td>90.89</td><td>11.00</td><td>0.00</td></tr><tr><td>100,000 CPT add</td><td>50.65</td><td>19.74</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>230.08</td><td>4.35</td><td>0.02</td></tr><tr><td>100,000 getNode</td><td>38.97</td><td>25.66</td><td>5.82e-4</td></tr><tr><td>100,000 add & iterator</td><td>118.32</td><td>8.45</td><td>0.01</td></tr></table></div>
|
|
639
794
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
640
795
|
<div class='collapsible level0' ><span class='json-to-html-label'>comparison</span></div>
|
|
641
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>SRC PQ 10,000 add</td><td>0.
|
|
796
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>SRC PQ 10,000 add</td><td>0.14</td><td>6939.33</td><td>1.74e-6</td></tr><tr><td>CJS PQ 10,000 add</td><td>0.15</td><td>6881.64</td><td>1.91e-6</td></tr><tr><td>MJS PQ 10,000 add</td><td>0.57</td><td>1745.92</td><td>1.60e-5</td></tr><tr><td>CPT PQ 10,000 add</td><td>0.57</td><td>1744.71</td><td>1.01e-5</td></tr><tr><td>SRC PQ 10,000 add & pop</td><td>3.51</td><td>284.93</td><td>6.79e-4</td></tr><tr><td>CJS PQ 10,000 add & pop</td><td>3.42</td><td>292.55</td><td>4.04e-5</td></tr><tr><td>MJS PQ 10,000 add & pop</td><td>3.41</td><td>293.38</td><td>5.11e-5</td></tr><tr><td>CPT PQ 10,000 add & pop</td><td>2.09</td><td>478.76</td><td>2.28e-5</td></tr><tr><td>CPT OM 100,000 add</td><td>43.22</td><td>23.14</td><td>0.00</td></tr><tr><td>CPT HM 10,000 set</td><td>0.58</td><td>1721.25</td><td>1.85e-5</td></tr><tr><td>CPT HM 10,000 set & get</td><td>0.68</td><td>1477.31</td><td>1.26e-5</td></tr><tr><td>CPT LL 1,000,000 unshift</td><td>81.38</td><td>12.29</td><td>0.02</td></tr><tr><td>CPT PQ 10,000 add & pop</td><td>2.10</td><td>476.50</td><td>1.60e-4</td></tr><tr><td>CPT DQ 1,000,000 push</td><td>22.51</td><td>44.42</td><td>0.00</td></tr><tr><td>CPT Q 1,000,000 push</td><td>47.85</td><td>20.90</td><td>0.01</td></tr><tr><td>CPT ST 1,000,000 push</td><td>42.54</td><td>23.51</td><td>0.01</td></tr><tr><td>CPT ST 1,000,000 push & pop</td><td>50.08</td><td>19.97</td><td>0.00</td></tr></table></div>
|
|
642
797
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
643
798
|
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
|
644
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.
|
|
799
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000 addVertex</td><td>0.11</td><td>9501.34</td><td>6.10e-6</td></tr><tr><td>1,000 addEdge</td><td>6.35</td><td>157.55</td><td>6.69e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.14e+4</td><td>2.50e-6</td></tr><tr><td>1,000 getEdge</td><td>25.00</td><td>39.99</td><td>0.01</td></tr><tr><td>tarjan</td><td>219.46</td><td>4.56</td><td>0.01</td></tr><tr><td>tarjan all</td><td>218.15</td><td>4.58</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>176.83</td><td>5.66</td><td>0.00</td></tr></table></div>
|
|
645
800
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
646
801
|
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</span></div>
|
|
647
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 set</td><td>
|
|
802
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 set</td><td>254.46</td><td>3.93</td><td>0.04</td></tr><tr><td>1,000,000 CPT set</td><td>251.21</td><td>3.98</td><td>0.03</td></tr><tr><td>1,000,000 Map set</td><td>211.27</td><td>4.73</td><td>0.01</td></tr><tr><td>1,000,000 Set add</td><td>175.15</td><td>5.71</td><td>0.02</td></tr><tr><td>1,000,000 set & get</td><td>370.54</td><td>2.70</td><td>0.11</td></tr><tr><td>1,000,000 CPT set & get</td><td>283.34</td><td>3.53</td><td>0.07</td></tr><tr><td>1,000,000 Map set & get</td><td>287.09</td><td>3.48</td><td>0.04</td></tr><tr><td>1,000,000 Set add & has</td><td>190.50</td><td>5.25</td><td>0.01</td></tr><tr><td>1,000,000 ObjKey set & get</td><td>880.47</td><td>1.14</td><td>0.10</td></tr><tr><td>1,000,000 Map ObjKey set & get</td><td>334.47</td><td>2.99</td><td>0.05</td></tr><tr><td>1,000,000 Set ObjKey add & has</td><td>310.12</td><td>3.22</td><td>0.06</td></tr></table></div>
|
|
648
803
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
649
804
|
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
650
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>
|
|
805
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add & pop</td><td>80.13</td><td>12.48</td><td>0.00</td></tr><tr><td>100,000 add & dfs</td><td>35.08</td><td>28.50</td><td>0.00</td></tr><tr><td>10,000 fib add & pop</td><td>367.84</td><td>2.72</td><td>0.01</td></tr></table></div>
|
|
651
806
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
652
807
|
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
|
653
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
808
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>237.28</td><td>4.21</td><td>0.07</td></tr><tr><td>1,000,000 CPT push</td><td>75.66</td><td>13.22</td><td>0.03</td></tr><tr><td>1,000,000 unshift</td><td>226.38</td><td>4.42</td><td>0.05</td></tr><tr><td>1,000,000 CPT unshift</td><td>93.34</td><td>10.71</td><td>0.07</td></tr><tr><td>1,000,000 unshift & shift</td><td>188.34</td><td>5.31</td><td>0.05</td></tr><tr><td>1,000,000 insertBefore</td><td>329.60</td><td>3.03</td><td>0.05</td></tr></table></div>
|
|
654
809
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
655
810
|
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
|
656
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>
|
|
811
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 push & pop</td><td>221.32</td><td>4.52</td><td>0.01</td></tr><tr><td>10,000 insertBefore</td><td>255.52</td><td>3.91</td><td>0.01</td></tr></table></div>
|
|
657
812
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
658
813
|
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
|
659
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>
|
|
814
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>10,000 refill & poll</td><td>9.07</td><td>110.24</td><td>2.71e-4</td></tr></table></div>
|
|
660
815
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
661
816
|
<div class='collapsible level0' ><span class='json-to-html-label'>priority-queue</span></div>
|
|
662
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add & pop</td><td>
|
|
817
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 add & pop</td><td>101.93</td><td>9.81</td><td>7.95e-4</td></tr><tr><td>100,000 CPT add & pop</td><td>28.54</td><td>35.04</td><td>0.00</td></tr></table></div>
|
|
663
818
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
664
819
|
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
|
665
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>14.
|
|
820
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>14.43</td><td>69.29</td><td>2.36e-4</td></tr><tr><td>1,000,000 CPT push</td><td>25.08</td><td>39.87</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>22.87</td><td>43.72</td><td>6.05e-4</td></tr><tr><td>1,000,000 push & shift</td><td>25.28</td><td>39.55</td><td>0.01</td></tr><tr><td>1,000,000 unshift & shift</td><td>21.88</td><td>45.71</td><td>2.05e-4</td></tr></table></div>
|
|
666
821
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
667
822
|
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
|
668
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
823
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>38.49</td><td>25.98</td><td>9.08e-4</td></tr><tr><td>1,000,000 CPT push</td><td>43.93</td><td>22.76</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>82.85</td><td>12.07</td><td>0.00</td></tr></table></div>
|
|
669
824
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
670
825
|
<div class='collapsible level0' ><span class='json-to-html-label'>stack</span></div>
|
|
671
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>
|
|
826
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>1,000,000 push</td><td>40.19</td><td>24.88</td><td>0.01</td></tr><tr><td>1,000,000 CPT push</td><td>39.87</td><td>25.08</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>41.67</td><td>24.00</td><td>0.01</td></tr><tr><td>1,000,000 CPT push & pop</td><td>46.65</td><td>21.44</td><td>0.00</td></tr></table></div>
|
|
672
827
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
673
828
|
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
|
674
|
-
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>
|
|
829
|
+
<div class="content"><table style="display: table; width:100%; table-layout: fixed;"><tr><th>test name</th><th>time taken (ms)</th><th>executions per sec</th><th>sample deviation</th></tr><tr><td>100,000 push</td><td>43.42</td><td>23.03</td><td>7.57e-4</td></tr><tr><td>100,000 getWords</td><td>93.41</td><td>10.71</td><td>0.00</td></tr></table></div>
|
|
675
830
|
</div>
|
|
676
831
|
|
|
677
832
|
[//]: # (No deletion!!! End of Replace Section)
|
|
678
833
|
|
|
679
834
|
## Built-in classic algorithms
|
|
680
835
|
|
|
681
|
-
<table>
|
|
836
|
+
<table style="display: table; width:100%; table-layout: fixed;">
|
|
682
837
|
<thead>
|
|
683
838
|
<tr>
|
|
684
839
|
<th>Algorithm</th>
|
|
@@ -778,7 +933,8 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
778
933
|
</table>
|
|
779
934
|
|
|
780
935
|
## Software Engineering Design Standards
|
|
781
|
-
|
|
936
|
+
|
|
937
|
+
<table style="display: table; width:100%; table-layout: fixed;">
|
|
782
938
|
<tr>
|
|
783
939
|
<th>Principle</th>
|
|
784
940
|
<th>Description</th>
|