data-structure-typed 1.45.3 → 1.46.1
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/CHANGELOG.md +1 -1
- package/README.md +91 -40
- package/benchmark/report.html +17 -17
- package/benchmark/report.json +160 -142
- package/dist/cjs/data-structures/hash/hash-map.d.ts +6 -5
- package/dist/cjs/data-structures/hash/hash-map.js +9 -6
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -1
- package/dist/cjs/data-structures/heap/heap.d.ts +59 -47
- package/dist/cjs/data-structures/heap/heap.js +133 -123
- package/dist/cjs/data-structures/heap/heap.js.map +1 -1
- package/dist/cjs/data-structures/queue/deque.d.ts +131 -164
- package/dist/cjs/data-structures/queue/deque.js +543 -211
- package/dist/cjs/data-structures/queue/deque.js.map +1 -1
- package/dist/cjs/types/data-structures/hash/hash-map.d.ts +0 -9
- package/dist/cjs/types/helpers.d.ts +11 -0
- package/dist/cjs/utils/utils.d.ts +1 -0
- package/dist/cjs/utils/utils.js +3 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/mjs/data-structures/hash/hash-map.d.ts +6 -5
- package/dist/mjs/data-structures/hash/hash-map.js +9 -6
- package/dist/mjs/data-structures/heap/heap.d.ts +59 -47
- package/dist/mjs/data-structures/heap/heap.js +133 -123
- package/dist/mjs/data-structures/queue/deque.d.ts +131 -164
- package/dist/mjs/data-structures/queue/deque.js +544 -201
- package/dist/mjs/types/data-structures/hash/hash-map.d.ts +0 -9
- package/dist/mjs/types/helpers.d.ts +11 -0
- package/dist/mjs/utils/utils.d.ts +1 -0
- package/dist/mjs/utils/utils.js +1 -0
- package/dist/umd/data-structure-typed.js +684 -328
- package/dist/umd/data-structure-typed.min.js +1 -1
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +1 -1
- package/src/data-structures/hash/hash-map.ts +11 -7
- package/src/data-structures/heap/heap.ts +132 -128
- package/src/data-structures/queue/deque.ts +605 -226
- package/src/types/data-structures/hash/hash-map.ts +0 -11
- package/src/types/helpers.ts +15 -0
- package/src/utils/utils.ts +2 -0
- package/test/performance/data-structures/linked-list/doubly-linked-list.test.ts +21 -0
- package/test/performance/data-structures/priority-queue/priority-queue.test.ts +7 -7
- package/test/performance/data-structures/queue/deque.test.ts +24 -13
- package/test/unit/data-structures/hash/hash-map.test.ts +4 -4
- package/test/unit/data-structures/heap/heap.test.ts +2 -1
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +3 -3
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +3 -3
- package/test/unit/data-structures/queue/deque.test.ts +252 -240
- /package/test/performance/data-structures/{comparation.test.ts → comparison.test.ts} +0 -0
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.
|
|
11
|
+
## [v1.46.1](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
|
12
12
|
|
|
13
13
|
### Changes
|
|
14
14
|
|
package/README.md
CHANGED
|
@@ -71,46 +71,96 @@ const {
|
|
|
71
71
|
} = dataStructureTyped;
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
## Software Engineering Design Standards
|
|
75
|
+
<table>
|
|
76
|
+
<tr>
|
|
77
|
+
<th>Principle</th>
|
|
78
|
+
<th>Description</th>
|
|
79
|
+
</tr>
|
|
80
|
+
<tr>
|
|
81
|
+
<td>Practicality</td>
|
|
82
|
+
<td>Follows ES6 and ESNext standards, offering unified and considerate optional parameters, and simplifies method names.</td>
|
|
83
|
+
</tr>
|
|
84
|
+
<tr>
|
|
85
|
+
<td>Extensibility</td>
|
|
86
|
+
<td>Adheres to OOP (Object-Oriented Programming) principles, allowing inheritance for all data structures.</td>
|
|
87
|
+
</tr>
|
|
88
|
+
<tr>
|
|
89
|
+
<td>Modularization</td>
|
|
90
|
+
<td>Includes data structure modularization and independent NPM packages.</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td>Efficiency</td>
|
|
94
|
+
<td>All methods provide time and space complexity, comparable to native JS performance.</td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td>Maintainability</td>
|
|
98
|
+
<td>Follows open-source community development standards, complete documentation, continuous integration, and adheres to TDD (Test-Driven Development) patterns.</td>
|
|
99
|
+
</tr>
|
|
100
|
+
<tr>
|
|
101
|
+
<td>Testability</td>
|
|
102
|
+
<td>Automated and customized unit testing, performance testing, and integration testing.</td>
|
|
103
|
+
</tr>
|
|
104
|
+
<tr>
|
|
105
|
+
<td>Portability</td>
|
|
106
|
+
<td>Plans for porting to Java, Python, and C++, currently achieved to 80%.</td>
|
|
107
|
+
</tr>
|
|
108
|
+
<tr>
|
|
109
|
+
<td>Reusability</td>
|
|
110
|
+
<td>Fully decoupled, minimized side effects, and adheres to OOP.</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>Security</td>
|
|
114
|
+
<td>Carefully designed security for member variables and methods. Read-write separation. Data structure software does not need to consider other security aspects.</td>
|
|
115
|
+
</tr>
|
|
116
|
+
<tr>
|
|
117
|
+
<td>Scalability</td>
|
|
118
|
+
<td>Data structure software does not involve load issues.</td>
|
|
119
|
+
</tr>
|
|
120
|
+
</table>
|
|
121
|
+
|
|
122
|
+
## Vivid Examples
|
|
123
|
+
|
|
124
|
+
### Binary Tree
|
|
75
125
|
[Try it out](https://vivid-algorithm.vercel.app/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
76
126
|
|
|
77
127
|

|
|
78
128
|
|
|
79
129
|
|
|
80
130
|
|
|
81
|
-
|
|
131
|
+
### Binary Tree DFS
|
|
82
132
|
[Try it out](https://vivid-algorithm.vercel.app/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
83
133
|
|
|
84
134
|

|
|
85
135
|
|
|
86
136
|
|
|
87
137
|
|
|
88
|
-
|
|
138
|
+
### AVL Tree
|
|
89
139
|
[Try it out](https://vivid-algorithm.vercel.app/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
90
140
|
|
|
91
141
|

|
|
92
142
|
|
|
93
143
|
|
|
94
|
-
|
|
144
|
+
### Tree Multi Map
|
|
95
145
|
[Try it out](https://vivid-algorithm.vercel.app/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
96
146
|
|
|
97
147
|

|
|
98
148
|
|
|
99
149
|
|
|
100
150
|
|
|
101
|
-
|
|
151
|
+
### Matrix
|
|
102
152
|
[Try it out](https://vivid-algorithm.vercel.app/algorithm/graph/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
103
153
|
|
|
104
154
|

|
|
105
155
|
|
|
106
156
|
|
|
107
|
-
|
|
157
|
+
### Directed Graph
|
|
108
158
|
[Try it out](https://vivid-algorithm.vercel.app/algorithm/graph/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
109
159
|
|
|
110
160
|

|
|
111
161
|
|
|
112
162
|
|
|
113
|
-
|
|
163
|
+
### Map Graph
|
|
114
164
|
[Try it out](https://vivid-algorithm.vercel.app/algorithm/graph/), or you can execute your own code using our [visual tool](https://github.com/zrwusa/vivid-algorithm)
|
|
115
165
|
|
|
116
166
|

|
|
@@ -568,7 +618,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
568
618
|
|
|
569
619
|
|
|
570
620
|
|
|
571
|
-
|
|
621
|
+
## Standard library data structure comparison
|
|
572
622
|
|
|
573
623
|
|
|
574
624
|
<table>
|
|
@@ -753,71 +803,72 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', '
|
|
|
753
803
|
</table>
|
|
754
804
|
|
|
755
805
|
|
|
756
|
-
## Code design
|
|
757
|
-
|
|
758
|
-
### Adhere to ES6 standard naming conventions for APIs.
|
|
759
|
-
|
|
760
|
-
Standardize API conventions by using 'add' and 'delete' for element manipulation methods in all data structures.
|
|
761
|
-
|
|
762
|
-
Opt for concise and clear method names, avoiding excessive length while ensuring explicit intent.
|
|
763
|
-
|
|
764
|
-
### Object-oriented programming(OOP)
|
|
765
|
-
|
|
766
|
-
By strictly adhering to object-oriented design (BinaryTree -> BST -> AVLTree -> TreeMultimap), you can seamlessly
|
|
767
|
-
inherit the existing data structures to implement the customized ones you need. Object-oriented design stands as the
|
|
768
|
-
optimal approach to data structure design.
|
|
769
|
-
|
|
770
806
|
## Benchmark
|
|
771
807
|
|
|
772
808
|
[//]: # (No deletion!!! Start of Replace Section)
|
|
773
809
|
<div class="json-to-html-collapse clearfix 0">
|
|
774
|
-
<div class='collapsible level0' ><span class='json-to-html-label'>
|
|
775
|
-
<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 10,000 add</td><td>0.
|
|
810
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>comparison</span></div>
|
|
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>SRC 10,000 add</td><td>0.57</td><td>1745.23</td><td>4.83e-6</td></tr><tr><td>CJS 10,000 add</td><td>0.57</td><td>1752.47</td><td>4.64e-6</td></tr><tr><td>MJS 10,000 add</td><td>0.59</td><td>1687.89</td><td>1.40e-4</td></tr><tr><td>SRC PQ 10,000 add & pop</td><td>3.41</td><td>293.00</td><td>2.65e-5</td></tr><tr><td>CJS PQ 10,000 add & pop</td><td>4.92</td><td>203.31</td><td>3.60e-5</td></tr><tr><td>MJS PQ 10,000 add & pop</td><td>4.88</td><td>204.72</td><td>4.35e-5</td></tr></table></div>
|
|
776
812
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
777
813
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
|
778
|
-
<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>
|
|
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 add randomly</td><td>31.02</td><td>32.24</td><td>2.83e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>71.45</td><td>14.00</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>40.21</td><td>24.87</td><td>4.47e-4</td></tr><tr><td>10,000 get</td><td>28.34</td><td>35.29</td><td>5.15e-4</td></tr></table></div>
|
|
779
815
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
780
816
|
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
|
781
|
-
<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>13.
|
|
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>1,000 add randomly</td><td>13.04</td><td>76.71</td><td>1.56e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>15.79</td><td>63.33</td><td>1.40e-4</td></tr><tr><td>1,000 addMany</td><td>10.25</td><td>97.60</td><td>1.08e-4</td></tr><tr><td>1,000 get</td><td>18.31</td><td>54.60</td><td>1.50e-4</td></tr><tr><td>1,000 dfs</td><td>155.22</td><td>6.44</td><td>8.11e-4</td></tr><tr><td>1,000 bfs</td><td>56.66</td><td>17.65</td><td>6.70e-4</td></tr><tr><td>1,000 morris</td><td>254.79</td><td>3.92</td><td>5.27e-4</td></tr></table></div>
|
|
782
818
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
783
819
|
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
|
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>28.
|
|
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>10,000 add randomly</td><td>28.23</td><td>35.42</td><td>3.20e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>68.35</td><td>14.63</td><td>8.46e-4</td></tr><tr><td>10,000 addMany</td><td>28.94</td><td>34.56</td><td>0.00</td></tr><tr><td>10,000 get</td><td>28.97</td><td>34.51</td><td>4.57e-4</td></tr></table></div>
|
|
785
821
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
786
822
|
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
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>100,000 add</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>100,000 add</td><td>89.12</td><td>11.22</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>219.00</td><td>4.57</td><td>0.00</td></tr><tr><td>100,000 getNode</td><td>105.74</td><td>9.46</td><td>6.09e-4</td></tr></table></div>
|
|
788
824
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
789
825
|
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
|
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>1,000 addVertex</td><td>0.
|
|
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 addVertex</td><td>0.10</td><td>9902.14</td><td>9.12e-7</td></tr><tr><td>1,000 addEdge</td><td>6.11</td><td>163.67</td><td>1.29e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.16e+4</td><td>3.51e-7</td></tr><tr><td>1,000 getEdge</td><td>23.63</td><td>42.33</td><td>0.00</td></tr><tr><td>tarjan</td><td>222.85</td><td>4.49</td><td>0.01</td></tr><tr><td>tarjan all</td><td>223.79</td><td>4.47</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>181.77</td><td>5.50</td><td>0.00</td></tr></table></div>
|
|
791
827
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
792
828
|
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</span></div>
|
|
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>10,000 set</td><td>1.00</td><td>1001.
|
|
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>10,000 set</td><td>1.00</td><td>1001.93</td><td>2.06e-5</td></tr><tr><td>10,000 set & get</td><td>1.51</td><td>661.53</td><td>2.65e-5</td></tr></table></div>
|
|
794
830
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
795
831
|
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
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>10,000 add & pop</td><td>
|
|
832
|
+
<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 & pop</td><td>5.82</td><td>171.79</td><td>5.13e-5</td></tr><tr><td>10,000 fib add & pop</td><td>359.24</td><td>2.78</td><td>0.00</td></tr></table></div>
|
|
797
833
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
798
834
|
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
|
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,000 unshift</td><td>
|
|
835
|
+
<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>214.50</td><td>4.66</td><td>0.05</td></tr><tr><td>1,000,000 unshift</td><td>205.89</td><td>4.86</td><td>0.05</td></tr><tr><td>1,000,000 unshift & shift</td><td>168.93</td><td>5.92</td><td>0.04</td></tr><tr><td>1,000,000 insertBefore</td><td>291.32</td><td>3.43</td><td>0.05</td></tr></table></div>
|
|
800
836
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
801
837
|
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
|
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>10,000 push & pop</td><td>
|
|
838
|
+
<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>215.82</td><td>4.63</td><td>0.02</td></tr><tr><td>10,000 insertBefore</td><td>248.56</td><td>4.02</td><td>0.01</td></tr></table></div>
|
|
803
839
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
804
840
|
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
|
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>10,000 refill & poll</td><td>
|
|
841
|
+
<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>8.85</td><td>113.01</td><td>1.90e-4</td></tr></table></div>
|
|
806
842
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
807
843
|
<div class='collapsible level0' ><span class='json-to-html-label'>priority-queue</span></div>
|
|
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>
|
|
844
|
+
<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>104.23</td><td>9.59</td><td>0.00</td></tr></table></div>
|
|
809
845
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
810
846
|
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
|
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>1,000,000 push</td><td>
|
|
847
|
+
<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.25</td><td>70.18</td><td>1.63e-4</td></tr><tr><td>1,000,000 push & pop</td><td>23.15</td><td>43.21</td><td>2.07e-4</td></tr><tr><td>1,000,000 push & shift</td><td>24.16</td><td>41.40</td><td>1.78e-4</td></tr><tr><td>1,000,000 unshift & shift</td><td>22.28</td><td>44.88</td><td>1.56e-4</td></tr></table></div>
|
|
812
848
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
813
849
|
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
|
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>1,000,000 push</td><td>
|
|
850
|
+
<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>45.72</td><td>21.87</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>81.75</td><td>12.23</td><td>0.00</td></tr></table></div>
|
|
815
851
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
816
852
|
<div class='collapsible level0' ><span class='json-to-html-label'>stack</span></div>
|
|
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>1,000,000 push</td><td>
|
|
853
|
+
<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>44.30</td><td>22.57</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>49.69</td><td>20.12</td><td>0.01</td></tr></table></div>
|
|
818
854
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
819
855
|
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
|
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>100,000 push</td><td>
|
|
856
|
+
<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.10</td><td>23.20</td><td>6.46e-4</td></tr><tr><td>100,000 getWords</td><td>85.45</td><td>11.70</td><td>0.00</td></tr></table></div>
|
|
821
857
|
</div>
|
|
822
858
|
|
|
823
|
-
[//]: # (No deletion!!! End of Replace Section)
|
|
859
|
+
[//]: # (No deletion!!! End of Replace Section)
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
## Codebase design
|
|
863
|
+
|
|
864
|
+
### Adhere to ES6 and ESNext standard naming conventions for APIs.
|
|
865
|
+
|
|
866
|
+
Standardize API conventions by using 'add' and 'delete' for element manipulation methods in all data structures.
|
|
867
|
+
|
|
868
|
+
Opt for concise and clear method names, avoiding excessive length while ensuring explicit intent.
|
|
869
|
+
|
|
870
|
+
### Object-oriented programming(OOP)
|
|
871
|
+
|
|
872
|
+
By strictly adhering to object-oriented design (BinaryTree -> BST -> AVLTree -> TreeMultimap), you can seamlessly
|
|
873
|
+
inherit the existing data structures to implement the customized ones you need. Object-oriented design stands as the
|
|
874
|
+
optimal approach to data structure design.
|
package/benchmark/report.html
CHANGED
|
@@ -42,53 +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'>
|
|
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>SRC 10,000 add</td><td>0.
|
|
45
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>comparison</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>SRC 10,000 add</td><td>0.57</td><td>1745.23</td><td>4.83e-6</td></tr><tr><td>CJS 10,000 add</td><td>0.57</td><td>1752.47</td><td>4.64e-6</td></tr><tr><td>MJS 10,000 add</td><td>0.59</td><td>1687.89</td><td>1.40e-4</td></tr><tr><td>SRC PQ 10,000 add & pop</td><td>3.41</td><td>293.00</td><td>2.65e-5</td></tr><tr><td>CJS PQ 10,000 add & pop</td><td>4.92</td><td>203.31</td><td>3.60e-5</td></tr><tr><td>MJS PQ 10,000 add & pop</td><td>4.88</td><td>204.72</td><td>4.35e-5</td></tr></table></div>
|
|
47
47
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
48
48
|
<div class='collapsible level0' ><span class='json-to-html-label'>avl-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>10,000 add randomly</td><td>
|
|
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>10,000 add randomly</td><td>31.02</td><td>32.24</td><td>2.83e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>71.45</td><td>14.00</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>40.21</td><td>24.87</td><td>4.47e-4</td></tr><tr><td>10,000 get</td><td>28.34</td><td>35.29</td><td>5.15e-4</td></tr></table></div>
|
|
50
50
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
51
51
|
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</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>1,000 add randomly</td><td>13.
|
|
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>1,000 add randomly</td><td>13.04</td><td>76.71</td><td>1.56e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>15.79</td><td>63.33</td><td>1.40e-4</td></tr><tr><td>1,000 addMany</td><td>10.25</td><td>97.60</td><td>1.08e-4</td></tr><tr><td>1,000 get</td><td>18.31</td><td>54.60</td><td>1.50e-4</td></tr><tr><td>1,000 dfs</td><td>155.22</td><td>6.44</td><td>8.11e-4</td></tr><tr><td>1,000 bfs</td><td>56.66</td><td>17.65</td><td>6.70e-4</td></tr><tr><td>1,000 morris</td><td>254.79</td><td>3.92</td><td>5.27e-4</td></tr></table></div>
|
|
53
53
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
54
54
|
<div class='collapsible level0' ><span class='json-to-html-label'>bst</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>10,000 add randomly</td><td>28.
|
|
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>10,000 add randomly</td><td>28.23</td><td>35.42</td><td>3.20e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>68.35</td><td>14.63</td><td>8.46e-4</td></tr><tr><td>10,000 addMany</td><td>28.94</td><td>34.56</td><td>0.00</td></tr><tr><td>10,000 get</td><td>28.97</td><td>34.51</td><td>4.57e-4</td></tr></table></div>
|
|
56
56
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
57
57
|
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</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>100,000 add</td><td>
|
|
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>100,000 add</td><td>89.12</td><td>11.22</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>219.00</td><td>4.57</td><td>0.00</td></tr><tr><td>100,000 getNode</td><td>105.74</td><td>9.46</td><td>6.09e-4</td></tr></table></div>
|
|
59
59
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
60
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.
|
|
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.10</td><td>9902.14</td><td>9.12e-7</td></tr><tr><td>1,000 addEdge</td><td>6.11</td><td>163.67</td><td>1.29e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.16e+4</td><td>3.51e-7</td></tr><tr><td>1,000 getEdge</td><td>23.63</td><td>42.33</td><td>0.00</td></tr><tr><td>tarjan</td><td>222.85</td><td>4.49</td><td>0.01</td></tr><tr><td>tarjan all</td><td>223.79</td><td>4.47</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>181.77</td><td>5.50</td><td>0.00</td></tr></table></div>
|
|
62
62
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
63
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>10,000 set</td><td>1.00</td><td>1001.
|
|
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>10,000 set</td><td>1.00</td><td>1001.93</td><td>2.06e-5</td></tr><tr><td>10,000 set & get</td><td>1.51</td><td>661.53</td><td>2.65e-5</td></tr></table></div>
|
|
65
65
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
66
66
|
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
|
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>10,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>10,000 add & pop</td><td>5.82</td><td>171.79</td><td>5.13e-5</td></tr><tr><td>10,000 fib add & pop</td><td>359.24</td><td>2.78</td><td>0.00</td></tr></table></div>
|
|
68
68
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
69
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 unshift</td><td>
|
|
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>214.50</td><td>4.66</td><td>0.05</td></tr><tr><td>1,000,000 unshift</td><td>205.89</td><td>4.86</td><td>0.05</td></tr><tr><td>1,000,000 unshift & shift</td><td>168.93</td><td>5.92</td><td>0.04</td></tr><tr><td>1,000,000 insertBefore</td><td>291.32</td><td>3.43</td><td>0.05</td></tr></table></div>
|
|
71
71
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
72
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>
|
|
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>215.82</td><td>4.63</td><td>0.02</td></tr><tr><td>10,000 insertBefore</td><td>248.56</td><td>4.02</td><td>0.01</td></tr></table></div>
|
|
74
74
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
75
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>
|
|
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>8.85</td><td>113.01</td><td>1.90e-4</td></tr></table></div>
|
|
77
77
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
78
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>
|
|
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>104.23</td><td>9.59</td><td>0.00</td></tr></table></div>
|
|
80
80
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
81
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>
|
|
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.25</td><td>70.18</td><td>1.63e-4</td></tr><tr><td>1,000,000 push & pop</td><td>23.15</td><td>43.21</td><td>2.07e-4</td></tr><tr><td>1,000,000 push & shift</td><td>24.16</td><td>41.40</td><td>1.78e-4</td></tr><tr><td>1,000,000 unshift & shift</td><td>22.28</td><td>44.88</td><td>1.56e-4</td></tr></table></div>
|
|
83
83
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
84
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>
|
|
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>45.72</td><td>21.87</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>81.75</td><td>12.23</td><td>0.00</td></tr></table></div>
|
|
86
86
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
87
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>
|
|
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>44.30</td><td>22.57</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>49.69</td><td>20.12</td><td>0.01</td></tr></table></div>
|
|
89
89
|
</div><div class="json-to-html-collapse clearfix 0">
|
|
90
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>
|
|
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.10</td><td>23.20</td><td>6.46e-4</td></tr><tr><td>100,000 getWords</td><td>85.45</td><td>11.70</td><td>0.00</td></tr></table></div>
|
|
92
92
|
</div>
|
|
93
93
|
|
|
94
94
|
</div>
|