mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2024-11-23 12:54:04 +00:00
release: v 1.43.1
This commit is contained in:
parent
c985317259
commit
649101ebe0
|
@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file.
|
|||
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
||||
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
||||
|
||||
## [v1.43.0](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
||||
## [v1.43.1](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
|
||||
|
||||
### Changes
|
||||
|
||||
|
|
30
README.md
30
README.md
|
@ -728,49 +728,49 @@ optimal approach to data structure design.
|
|||
[//]: # (No deletion!!! Start of Replace Section)
|
||||
<div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>avl-tree</span></div>
|
||||
<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.34</td><td>31.90</td><td>3.63e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>71.68</td><td>13.95</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>48.63</td><td>20.56</td><td>0.01</td></tr><tr><td>10,000 get</td><td>28.99</td><td>34.49</td><td>0.00</td></tr></table></div>
|
||||
<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>35.38</td><td>28.26</td><td>0.00</td></tr><tr><td>10,000 add & delete randomly</td><td>80.65</td><td>12.40</td><td>0.01</td></tr><tr><td>10,000 addMany</td><td>46.45</td><td>21.53</td><td>9.97e-4</td></tr><tr><td>10,000 get</td><td>31.59</td><td>31.66</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>binary-tree</span></div>
|
||||
<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>12.47</td><td>80.21</td><td>2.46e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>16.29</td><td>61.39</td><td>0.00</td></tr><tr><td>1,000 addMany</td><td>10.34</td><td>96.67</td><td>1.78e-4</td></tr><tr><td>1,000 get</td><td>22.72</td><td>44.02</td><td>0.01</td></tr><tr><td>1,000 dfs</td><td>167.13</td><td>5.98</td><td>0.01</td></tr><tr><td>1,000 bfs</td><td>57.06</td><td>17.53</td><td>4.63e-4</td></tr><tr><td>1,000 morris</td><td>272.80</td><td>3.67</td><td>0.01</td></tr></table></div>
|
||||
<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.01</td><td>76.84</td><td>7.71e-4</td></tr><tr><td>1,000 add & delete randomly</td><td>16.82</td><td>59.46</td><td>0.00</td></tr><tr><td>1,000 addMany</td><td>10.46</td><td>95.62</td><td>2.13e-4</td></tr><tr><td>1,000 get</td><td>18.44</td><td>54.22</td><td>2.49e-4</td></tr><tr><td>1,000 dfs</td><td>163.31</td><td>6.12</td><td>0.01</td></tr><tr><td>1,000 bfs</td><td>58.07</td><td>17.22</td><td>0.00</td></tr><tr><td>1,000 morris</td><td>273.11</td><td>3.66</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>bst</span></div>
|
||||
<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.28</td><td>33.02</td><td>4.41e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>73.93</td><td>13.53</td><td>0.01</td></tr><tr><td>10,000 addMany</td><td>29.66</td><td>33.72</td><td>0.00</td></tr><tr><td>10,000 get</td><td>27.96</td><td>35.76</td><td>3.35e-4</td></tr></table></div>
|
||||
<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.44</td><td>29.91</td><td>5.09e-4</td></tr><tr><td>10,000 add & delete randomly</td><td>76.03</td><td>13.15</td><td>0.00</td></tr><tr><td>10,000 addMany</td><td>32.26</td><td>31.00</td><td>0.00</td></tr><tr><td>10,000 get</td><td>32.75</td><td>30.53</td><td>0.01</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
||||
<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 randomly</td><td>89.26</td><td>11.20</td><td>0.01</td></tr><tr><td>100,000 add & delete randomly</td><td>218.90</td><td>4.57</td><td>0.01</td></tr><tr><td>100,000 getNode</td><td>41.74</td><td>23.96</td><td>0.00</td></tr></table></div>
|
||||
<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>99.27</td><td>10.07</td><td>0.01</td></tr><tr><td>100,000 add & delete randomly</td><td>233.22</td><td>4.29</td><td>0.01</td></tr><tr><td>100,000 getNode</td><td>148.41</td><td>6.74</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>directed-graph</span></div>
|
||||
<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>9995.32</td><td>1.43e-6</td></tr><tr><td>1,000 addEdge</td><td>6.32</td><td>158.28</td><td>7.89e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.17e+4</td><td>2.66e-7</td></tr><tr><td>1,000 getEdge</td><td>23.68</td><td>42.23</td><td>0.00</td></tr><tr><td>tarjan</td><td>214.15</td><td>4.67</td><td>0.01</td></tr><tr><td>tarjan all</td><td>214.51</td><td>4.66</td><td>0.00</td></tr><tr><td>topologicalSort</td><td>182.64</td><td>5.48</td><td>0.01</td></tr></table></div>
|
||||
<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>9381.52</td><td>3.21e-6</td></tr><tr><td>1,000 addEdge</td><td>6.36</td><td>157.14</td><td>7.19e-4</td></tr><tr><td>1,000 getVertex</td><td>0.05</td><td>2.09e+4</td><td>2.72e-6</td></tr><tr><td>1,000 getEdge</td><td>24.66</td><td>40.55</td><td>0.00</td></tr><tr><td>tarjan</td><td>219.65</td><td>4.55</td><td>0.01</td></tr><tr><td>tarjan all</td><td>239.68</td><td>4.17</td><td>0.04</td></tr><tr><td>topologicalSort</td><td>216.14</td><td>4.63</td><td>0.07</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>hash-map</span></div>
|
||||
<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>16.51</td><td>60.57</td><td>9.87e-4</td></tr><tr><td>10,000 set & get</td><td>34.75</td><td>28.77</td><td>6.11e-4</td></tr></table></div>
|
||||
<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>19.50</td><td>51.27</td><td>0.01</td></tr><tr><td>10,000 set & get</td><td>38.20</td><td>26.18</td><td>0.01</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>heap</span></div>
|
||||
<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>4.62</td><td>216.34</td><td>4.19e-5</td></tr><tr><td>10,000 fib add & pop</td><td>358.77</td><td>2.79</td><td>0.00</td></tr></table></div>
|
||||
<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>4.86</td><td>205.69</td><td>7.04e-4</td></tr><tr><td>10,000 fib add & pop</td><td>386.50</td><td>2.59</td><td>0.03</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>doubly-linked-list</span></div>
|
||||
<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>232.43</td><td>4.30</td><td>0.09</td></tr><tr><td>1,000,000 unshift & shift</td><td>174.59</td><td>5.73</td><td>0.05</td></tr><tr><td>1,000,000 insertBefore</td><td>322.71</td><td>3.10</td><td>0.07</td></tr></table></div>
|
||||
<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>243.46</td><td>4.11</td><td>0.05</td></tr><tr><td>1,000,000 unshift & shift</td><td>178.49</td><td>5.60</td><td>0.02</td></tr><tr><td>1,000,000 insertBefore</td><td>326.38</td><td>3.06</td><td>0.07</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>singly-linked-list</span></div>
|
||||
<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>216.35</td><td>4.62</td><td>0.01</td></tr><tr><td>10,000 insertBefore</td><td>246.91</td><td>4.05</td><td>0.00</td></tr></table></div>
|
||||
<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>232.85</td><td>4.29</td><td>0.01</td></tr><tr><td>10,000 insertBefore</td><td>255.90</td><td>3.91</td><td>0.01</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>max-priority-queue</span></div>
|
||||
<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>11.67</td><td>85.71</td><td>2.89e-4</td></tr></table></div>
|
||||
<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>11.88</td><td>84.15</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>priority-queue</span></div>
|
||||
<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>12.43</td><td>80.44</td><td>1.15e-4</td></tr></table></div>
|
||||
<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>12.60</td><td>79.35</td><td>1.40e-4</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>deque</span></div>
|
||||
<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>222.16</td><td>4.50</td><td>0.06</td></tr><tr><td>1,000,000 shift</td><td>26.33</td><td>37.98</td><td>0.00</td></tr></table></div>
|
||||
<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>226.32</td><td>4.42</td><td>0.03</td></tr><tr><td>1,000,000 shift</td><td>26.09</td><td>38.33</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>queue</span></div>
|
||||
<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.99</td><td>21.74</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>80.49</td><td>12.42</td><td>0.00</td></tr></table></div>
|
||||
<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.45</td><td>22.00</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>82.87</td><td>12.07</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>stack</span></div>
|
||||
<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.04</td><td>22.71</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>50.06</td><td>19.98</td><td>0.01</td></tr></table></div>
|
||||
<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>43.95</td><td>22.75</td><td>0.01</td></tr><tr><td>1,000,000 push & pop</td><td>50.91</td><td>19.64</td><td>0.00</td></tr></table></div>
|
||||
</div><div class="json-to-html-collapse clearfix 0">
|
||||
<div class='collapsible level0' ><span class='json-to-html-label'>trie</span></div>
|
||||
<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>44.87</td><td>22.29</td><td>7.28e-4</td></tr><tr><td>100,000 getWords</td><td>88.45</td><td>11.31</td><td>0.00</td></tr></table></div>
|
||||
<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>50.20</td><td>19.92</td><td>0.00</td></tr><tr><td>100,000 getWords</td><td>110.08</td><td>9.08</td><td>0.01</td></tr></table></div>
|
||||
</div>
|
||||
|
||||
[//]: # (No deletion!!! End of Replace Section)
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "data-structure-typed",
|
||||
"version": "1.43.0",
|
||||
"version": "1.43.1",
|
||||
"description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
|
||||
"main": "dist/cjs/src/index.js",
|
||||
"module": "dist/mjs/src/index.js",
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export const isDebugTest = false;
|
||||
export const isCompetitor = false;
|
||||
export const isDebugTest: boolean = false;
|
||||
export const isCompetitor: boolean = false;
|
||||
|
|
|
@ -16,17 +16,6 @@
|
|||
|
||||
|
||||
try {
|
||||
const {AVLTree, Queue} = window.dataStructureTyped;
|
||||
const avlTree = new AVLTree();
|
||||
const $avlTree = document.createElement('li');
|
||||
const $avlTreeSpan = document.createElement('span');
|
||||
$avlTreeSpan.innerText = 'AVLTree';
|
||||
$avlTree.append($avlTreeSpan);
|
||||
avlTree.add(1, 1);
|
||||
console.log(avlTree.bfs());
|
||||
$modules.append($avlTree);
|
||||
|
||||
|
||||
const queue = new Queue();
|
||||
for (let i = 0; i < 100000; i++) {
|
||||
queue.enqueue(i);
|
||||
|
@ -43,6 +32,22 @@
|
|||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
try {
|
||||
const {AVLTree} = window.dataStructureTyped;
|
||||
const avlTree = new AVLTree();
|
||||
const $avlTree = document.createElement('li');
|
||||
const $avlTreeSpan = document.createElement('span');
|
||||
$avlTreeSpan.innerText = 'AVLTree';
|
||||
$avlTree.append($avlTreeSpan);
|
||||
for (let i = 1; i < 31; i++) {
|
||||
avlTree.add(i, i);
|
||||
}
|
||||
console.log(avlTree.bfs());
|
||||
// avlTree.print();
|
||||
$modules.append($avlTree);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
const {BinaryTree} = dataStructureTyped;
|
||||
|
@ -66,6 +71,20 @@
|
|||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const {RedBlackTree} = dataStructureTyped;
|
||||
const tree = new RedBlackTree();
|
||||
for (let i = 1; i < 31; i++) {
|
||||
tree.add(i, i);
|
||||
}
|
||||
console.log(tree.isPerfectlyBalanced());
|
||||
tree.print();
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -11,7 +11,7 @@ const arr = getRandomIntArray(HUNDRED_THOUSAND, 0, HUNDRED_THOUSAND, true);
|
|||
const competitor = new OrderedMap<number, number>();
|
||||
|
||||
suite
|
||||
.add(`${HUNDRED_THOUSAND.toLocaleString()} add randomly`, () => {
|
||||
.add(`${HUNDRED_THOUSAND.toLocaleString()} add`, () => {
|
||||
rbTree.clear();
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
rbTree.add(arr[i]);
|
||||
|
@ -20,7 +20,7 @@ suite
|
|||
|
||||
|
||||
if (isCompetitor) {
|
||||
suite.add(`${HUNDRED_THOUSAND.toLocaleString()} competitor add randomly`, () => {
|
||||
suite.add(`${HUNDRED_THOUSAND.toLocaleString()} competitor add`, () => {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
competitor.setElement(arr[i], arr[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue