data-structure-typed 1.47.5 → 1.47.7
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 +103 -28
- 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 +36 -18
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +46 -29
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +158 -129
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +182 -184
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +73 -63
- package/dist/cjs/data-structures/binary-tree/bst.js +168 -169
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +54 -17
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +77 -31
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -1
- package/dist/cjs/data-structures/binary-tree/tree-multimap.d.ts +29 -40
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js +66 -136
- package/dist/cjs/data-structures/binary-tree/tree-multimap.js.map +1 -1
- package/dist/cjs/data-structures/graph/abstract-graph.js +1 -1
- package/dist/cjs/data-structures/graph/abstract-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/heap/heap.d.ts +19 -21
- package/dist/cjs/data-structures/heap/heap.js +52 -34
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/max-heap.d.ts +2 -5
- package/dist/cjs/data-structures/heap/max-heap.js +2 -2
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -1
- package/dist/cjs/data-structures/heap/min-heap.d.ts +2 -5
- package/dist/cjs/data-structures/heap/min-heap.js +2 -2
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +9 -1
- 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 +2 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +8 -1
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +2 -5
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +2 -2
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +2 -5
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +2 -2
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +2 -5
- package/dist/cjs/data-structures/priority-queue/priority-queue.js +2 -2
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +1 -0
- package/dist/cjs/data-structures/queue/deque.js +3 -0
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/data-structures/queue/queue.d.ts +1 -0
- package/dist/cjs/data-structures/queue/queue.js +3 -0
- package/dist/cjs/data-structures/queue/queue.js.map +1 -1
- package/dist/cjs/data-structures/stack/stack.d.ts +2 -1
- package/dist/cjs/data-structures/stack/stack.js +10 -2
- 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 +4 -2
- package/dist/cjs/types/common.d.ts +7 -0
- package/dist/cjs/types/common.js.map +1 -1
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +2 -2
- package/dist/cjs/types/data-structures/hash/hash-map.d.ts +1 -2
- package/dist/cjs/types/data-structures/heap/heap.d.ts +4 -1
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.d.ts +2 -1
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +36 -18
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +49 -30
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +158 -129
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +182 -194
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +73 -63
- package/dist/mjs/data-structures/binary-tree/bst.js +171 -170
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +54 -17
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +81 -33
- package/dist/mjs/data-structures/binary-tree/tree-multimap.d.ts +29 -40
- package/dist/mjs/data-structures/binary-tree/tree-multimap.js +70 -138
- package/dist/mjs/data-structures/graph/abstract-graph.js +1 -1
- 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/heap/heap.d.ts +19 -21
- package/dist/mjs/data-structures/heap/heap.js +53 -35
- package/dist/mjs/data-structures/heap/max-heap.d.ts +2 -5
- package/dist/mjs/data-structures/heap/max-heap.js +2 -2
- package/dist/mjs/data-structures/heap/min-heap.d.ts +2 -5
- package/dist/mjs/data-structures/heap/min-heap.js +2 -2
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +9 -1
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +2 -1
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +8 -1
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +2 -5
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +2 -2
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +2 -5
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +2 -2
- package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +2 -5
- package/dist/mjs/data-structures/priority-queue/priority-queue.js +2 -2
- package/dist/mjs/data-structures/queue/deque.d.ts +1 -0
- package/dist/mjs/data-structures/queue/deque.js +3 -0
- package/dist/mjs/data-structures/queue/queue.d.ts +1 -0
- package/dist/mjs/data-structures/queue/queue.js +3 -0
- package/dist/mjs/data-structures/stack/stack.d.ts +2 -1
- package/dist/mjs/data-structures/stack/stack.js +10 -2
- 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 +4 -2
- package/dist/mjs/types/common.d.ts +7 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +2 -2
- package/dist/mjs/types/data-structures/hash/hash-map.d.ts +1 -2
- package/dist/mjs/types/data-structures/heap/heap.d.ts +4 -1
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.d.ts +2 -1
- package/dist/umd/data-structure-typed.js +629 -595
- 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 +61 -31
- package/src/data-structures/binary-tree/binary-tree.ts +283 -254
- package/src/data-structures/binary-tree/bst.ts +193 -170
- package/src/data-structures/binary-tree/rb-tree.ts +87 -32
- package/src/data-structures/binary-tree/tree-multimap.ts +76 -136
- package/src/data-structures/graph/abstract-graph.ts +1 -1
- package/src/data-structures/hash/hash-map.ts +8 -8
- package/src/data-structures/heap/heap.ts +57 -39
- package/src/data-structures/heap/max-heap.ts +5 -5
- package/src/data-structures/heap/min-heap.ts +5 -5
- package/src/data-structures/linked-list/doubly-linked-list.ts +10 -1
- package/src/data-structures/linked-list/singly-linked-list.ts +9 -1
- package/src/data-structures/priority-queue/max-priority-queue.ts +4 -3
- package/src/data-structures/priority-queue/min-priority-queue.ts +12 -12
- package/src/data-structures/priority-queue/priority-queue.ts +3 -3
- package/src/data-structures/queue/deque.ts +4 -0
- package/src/data-structures/queue/queue.ts +4 -0
- package/src/data-structures/stack/stack.ts +12 -3
- package/src/data-structures/trie/trie.ts +23 -4
- package/src/interfaces/binary-tree.ts +14 -2
- package/src/types/common.ts +15 -1
- package/src/types/data-structures/binary-tree/binary-tree.ts +1 -1
- package/src/types/data-structures/binary-tree/bst.ts +2 -3
- package/src/types/data-structures/hash/hash-map.ts +1 -2
- package/src/types/data-structures/heap/heap.ts +3 -1
- package/src/types/data-structures/priority-queue/priority-queue.ts +3 -1
- package/test/integration/{all-in-one.ts → all-in-one.test.ts} +1 -1
- package/test/integration/index.html +87 -0
- package/test/performance/data-structures/comparison/comparison.test.ts +7 -6
- package/test/performance/data-structures/heap/heap.test.ts +2 -2
- package/test/performance/data-structures/priority-queue/priority-queue.test.ts +1 -1
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +20 -20
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +56 -57
- 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/tree-multimap.test.ts +118 -66
- package/test/unit/data-structures/heap/heap.test.ts +2 -2
- package/test/unit/data-structures/heap/max-heap.test.ts +1 -1
- package/test/unit/data-structures/heap/min-heap.test.ts +1 -1
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +4 -3
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +9 -10
- package/test/unit/data-structures/stack/stack.test.ts +2 -2
- package/test/unit/unrestricted-interconversion.test.ts +156 -0
- package/tsconfig-cjs.json +1 -1
- package/test/integration/conversion.test.ts +0 -0
|
@@ -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.7](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,77 @@ 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
|
+
|
|
313
|
+
const deque = new Deque(orgArr);
|
|
314
|
+
deque.print();
|
|
315
|
+
|
|
316
|
+
const sList = new SinglyLinkedList(orgArr);
|
|
317
|
+
sList.print();
|
|
318
|
+
|
|
319
|
+
const dList = new DoublyLinkedList(orgArr);
|
|
320
|
+
dList.print();
|
|
321
|
+
|
|
322
|
+
const stack = new Stack(orgArr);
|
|
323
|
+
stack.print();
|
|
324
|
+
|
|
325
|
+
const minHeap = new MinHeap(orgArr);
|
|
326
|
+
minHeap.print();
|
|
327
|
+
|
|
328
|
+
const maxPQ = new MaxPriorityQueue(orgArr);
|
|
329
|
+
maxPQ.print();
|
|
330
|
+
|
|
331
|
+
const biTree = new BinaryTree(entries);
|
|
332
|
+
biTree.print();
|
|
333
|
+
|
|
334
|
+
const bst = new BST(entries);
|
|
335
|
+
bst.print();
|
|
336
|
+
|
|
337
|
+
const rbTree = new RedBlackTree(entries);
|
|
338
|
+
rbTree.print();
|
|
339
|
+
|
|
340
|
+
const avl = new AVLTree(entries);
|
|
341
|
+
avl.print();
|
|
342
|
+
|
|
343
|
+
const treeMulti = new TreeMultimap(entries);
|
|
344
|
+
treeMulti.print();
|
|
345
|
+
|
|
346
|
+
const hm = new HashMap(entries);
|
|
347
|
+
hm.print()
|
|
348
|
+
const rbTreeH = new RedBlackTree(hm);
|
|
349
|
+
rbTreeH.print();
|
|
350
|
+
|
|
351
|
+
const pq = new MinPriorityQueue(orgArr);
|
|
352
|
+
pq.print();
|
|
353
|
+
const bst1 = new BST(pq);
|
|
354
|
+
bst1.print();
|
|
355
|
+
|
|
356
|
+
const dq1 = new Deque(orgArr);
|
|
357
|
+
dq1.print();
|
|
358
|
+
const rbTree1 = new RedBlackTree(dq1);
|
|
359
|
+
rbTree1.print();
|
|
360
|
+
|
|
361
|
+
const trie2 = new Trie(orgStrArr);
|
|
362
|
+
trie2.print();
|
|
363
|
+
const heap2 = new Heap(trie2, { comparator: (a, b) => Number(a) - Number(b) });
|
|
364
|
+
heap2.print();
|
|
365
|
+
const dq2 = new Deque(heap2);
|
|
366
|
+
dq2.print();
|
|
367
|
+
const entries2 = dq2.map((el, i) => [i, el]);
|
|
368
|
+
const avl2 = new AVLTree(entries2);
|
|
369
|
+
avl2.print();
|
|
296
370
|
```
|
|
297
371
|
|
|
298
372
|
## API docs & Examples
|
|
@@ -626,52 +700,52 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
626
700
|
[//]: # (No deletion!!! Start of Replace Section)
|
|
627
701
|
<div class="json-to-html-collapse clearfix 0">
|
|
628
702
|
<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>
|
|
703
|
+
<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
704
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
631
705
|
<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>
|
|
706
|
+
<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
707
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
634
708
|
<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>
|
|
709
|
+
<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
710
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
637
711
|
<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>
|
|
712
|
+
<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
713
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
640
714
|
<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.
|
|
715
|
+
<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
716
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
643
717
|
<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.
|
|
718
|
+
<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
719
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
646
720
|
<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>
|
|
721
|
+
<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
722
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
649
723
|
<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>
|
|
724
|
+
<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
725
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
652
726
|
<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>
|
|
727
|
+
<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
728
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
655
729
|
<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>
|
|
730
|
+
<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
731
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
658
732
|
<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>
|
|
733
|
+
<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
734
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
661
735
|
<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>
|
|
736
|
+
<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
737
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
664
738
|
<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.
|
|
739
|
+
<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
740
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
667
741
|
<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>
|
|
742
|
+
<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
743
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
670
744
|
<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>
|
|
745
|
+
<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
746
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
673
747
|
<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>
|
|
748
|
+
<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
749
|
</div>
|
|
676
750
|
|
|
677
751
|
[//]: # (No deletion!!! End of Replace Section)
|
|
@@ -778,6 +852,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
778
852
|
</table>
|
|
779
853
|
|
|
780
854
|
## Software Engineering Design Standards
|
|
855
|
+
|
|
781
856
|
<table>
|
|
782
857
|
<tr>
|
|
783
858
|
<th>Principle</th>
|
package/SECURITY.md
CHANGED
package/benchmark/report.html
CHANGED
|
@@ -42,8 +42,53 @@
|
|
|
42
42
|
</head>
|
|
43
43
|
<body>
|
|
44
44
|
<div id="json-to-html"><div class="json-to-html-collapse clearfix 0">
|
|
45
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
46
|
+
<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>
|
|
47
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
48
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
|
49
|
+
<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>
|
|
50
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
51
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
52
|
+
<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>
|
|
53
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
54
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
55
|
+
<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>
|
|
56
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
57
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>comparison</span></div>
|
|
58
|
+
<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>
|
|
59
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
60
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
|
61
|
+
<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>
|
|
62
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
63
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</span></div>
|
|
64
|
+
<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>
|
|
65
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
45
66
|
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
46
|
-
<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>
|
|
67
|
+
<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>
|
|
68
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
69
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
|
70
|
+
<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>
|
|
71
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
72
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
|
73
|
+
<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>
|
|
74
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
75
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
|
76
|
+
<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>
|
|
77
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
78
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>priority-queue</span></div>
|
|
79
|
+
<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>
|
|
80
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
81
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
|
82
|
+
<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>
|
|
83
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
84
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
|
85
|
+
<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>
|
|
86
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
87
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>stack</span></div>
|
|
88
|
+
<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>
|
|
89
|
+
</div><div class="json-to-html-collapse clearfix 0">
|
|
90
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
|
91
|
+
<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>
|
|
47
92
|
</div>
|
|
48
93
|
|
|
49
94
|
</div>
|