release: v1.52.6

This commit is contained in:
Revone 2024-10-29 17:27:40 +13:00
parent a29dc270e6
commit aece11bd01
10 changed files with 142 additions and 151 deletions

View file

@ -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.52.4](https://github.com/zrwusa/data-structure-typed/compare/v1.51.5...main) (upcoming)
## [v1.52.6](https://github.com/zrwusa/data-structure-typed/compare/v1.51.5...main) (upcoming)
### Changes

View file

@ -823,43 +823,43 @@ Version 11.7.9
[//]: # (No deletion!!! Start of Replace Section)
<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>100,000 add</td><td>7.55</td><td>132.36</td><td>2.00e-4</td></tr><tr><td>100,000 add & poll</td><td>44.17</td><td>22.64</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>7.51</td><td>133.17</td><td>1.36e-4</td></tr><tr><td>100,000 add & poll</td><td>44.25</td><td>22.60</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'>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</td><td>77.03</td><td>12.98</td><td>0.00</td></tr><tr><td>100,000 add randomly</td><td>80.74</td><td>12.38</td><td>0.00</td></tr><tr><td>100,000 get</td><td>111.29</td><td>8.99</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>24.91</td><td>40.14</td><td>0.01</td></tr><tr><td>100,000 add & delete orderly</td><td>153.12</td><td>6.53</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>233.76</td><td>4.28</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>76.98</td><td>12.99</td><td>0.00</td></tr><tr><td>100,000 add randomly</td><td>80.96</td><td>12.35</td><td>0.00</td></tr><tr><td>100,000 get</td><td>111.72</td><td>8.95</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>29.58</td><td>33.81</td><td>0.00</td></tr><tr><td>100,000 add & delete orderly</td><td>153.21</td><td>6.53</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>233.26</td><td>4.29</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>43.79</td><td>22.83</td><td>0.01</td></tr><tr><td>100,000 push & shift</td><td>5.09</td><td>196.54</td><td>5.29e-4</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2134.49</td><td>0.47</td><td>0.18</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>42.18</td><td>23.71</td><td>0.01</td></tr><tr><td>100,000 push & shift</td><td>5.16</td><td>193.66</td><td>7.47e-4</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2386.29</td><td>0.42</td><td>0.30</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>25.39</td><td>39.39</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>32.93</td><td>30.37</td><td>0.01</td></tr><tr><td>1,000,000 push & shift</td><td>32.36</td><td>30.90</td><td>0.00</td></tr><tr><td>100,000 push & shift</td><td>3.41</td><td>293.26</td><td>3.14e-4</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2309.81</td><td>0.43</td><td>0.46</td></tr><tr><td>100,000 unshift & shift</td><td>3.24</td><td>308.35</td><td>3.36e-4</td></tr><tr><td>Native JS Array 100,000 unshift & shift</td><td>4213.92</td><td>0.24</td><td>0.20</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>23.59</td><td>42.40</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>31.93</td><td>31.32</td><td>0.00</td></tr><tr><td>1,000,000 push & shift</td><td>33.12</td><td>30.19</td><td>0.00</td></tr><tr><td>100,000 push & shift</td><td>3.50</td><td>285.57</td><td>9.51e-4</td></tr><tr><td>Native JS Array 100,000 push & shift</td><td>2211.26</td><td>0.45</td><td>0.34</td></tr><tr><td>100,000 unshift & shift</td><td>3.41</td><td>292.89</td><td>5.52e-4</td></tr><tr><td>Native JS Array 100,000 unshift & shift</td><td>4343.81</td><td>0.23</td><td>0.25</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>1,000,000 set</td><td>107.76</td><td>9.28</td><td>0.02</td></tr><tr><td>Native JS Map 1,000,000 set</td><td>204.81</td><td>4.88</td><td>0.02</td></tr><tr><td>Native JS Set 1,000,000 add</td><td>165.26</td><td>6.05</td><td>0.01</td></tr><tr><td>1,000,000 set & get</td><td>121.13</td><td>8.26</td><td>0.02</td></tr><tr><td>Native JS Map 1,000,000 set & get</td><td>265.52</td><td>3.77</td><td>0.01</td></tr><tr><td>Native JS Set 1,000,000 add & has</td><td>167.98</td><td>5.95</td><td>0.01</td></tr><tr><td>1,000,000 ObjKey set & get</td><td>331.86</td><td>3.01</td><td>0.04</td></tr><tr><td>Native JS Map 1,000,000 ObjKey set & get</td><td>322.12</td><td>3.10</td><td>0.05</td></tr><tr><td>Native JS Set 1,000,000 ObjKey add & has</td><td>267.74</td><td>3.73</td><td>0.03</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 set</td><td>259.74</td><td>3.85</td><td>0.07</td></tr><tr><td>Native JS Map 1,000,000 set</td><td>208.35</td><td>4.80</td><td>0.02</td></tr><tr><td>Native JS Set 1,000,000 add</td><td>167.66</td><td>5.96</td><td>0.01</td></tr><tr><td>1,000,000 set & get</td><td>260.46</td><td>3.84</td><td>0.04</td></tr><tr><td>Native JS Map 1,000,000 set & get</td><td>265.09</td><td>3.77</td><td>0.02</td></tr><tr><td>Native JS Set 1,000,000 add & has</td><td>169.15</td><td>5.91</td><td>0.01</td></tr><tr><td>1,000,000 ObjKey set & get</td><td>317.23</td><td>3.15</td><td>0.04</td></tr><tr><td>Native JS Map 1,000,000 ObjKey set & get</td><td>304.84</td><td>3.28</td><td>0.04</td></tr><tr><td>Native JS Set 1,000,000 ObjKey add & has</td><td>278.30</td><td>3.59</td><td>0.05</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>42.79</td><td>23.37</td><td>7.76e-4</td></tr><tr><td>100,000 getWords</td><td>81.82</td><td>12.22</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>43.93</td><td>22.76</td><td>5.95e-4</td></tr><tr><td>100,000 getWords</td><td>82.18</td><td>12.17</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'>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>100,000 add</td><td>270.76</td><td>3.69</td><td>0.01</td></tr><tr><td>100,000 add randomly</td><td>326.94</td><td>3.06</td><td>0.00</td></tr><tr><td>100,000 get</td><td>129.13</td><td>7.74</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>30.96</td><td>32.30</td><td>0.00</td></tr><tr><td>100,000 add & delete orderly</td><td>440.62</td><td>2.27</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>589.06</td><td>1.70</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>275.72</td><td>3.63</td><td>0.00</td></tr><tr><td>100,000 add randomly</td><td>332.35</td><td>3.01</td><td>0.00</td></tr><tr><td>100,000 get</td><td>129.56</td><td>7.72</td><td>0.00</td></tr><tr><td>100,000 iterator</td><td>32.03</td><td>31.22</td><td>0.01</td></tr><tr><td>100,000 add & delete orderly</td><td>447.87</td><td>2.23</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>605.40</td><td>1.65</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'>binary-tree-overall</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 RBTree add randomly</td><td>6.89</td><td>145.16</td><td>9.69e-5</td></tr><tr><td>10,000 RBTree get randomly</td><td>9.22</td><td>108.43</td><td>1.55e-4</td></tr><tr><td>10,000 RBTree add & delete randomly</td><td>18.70</td><td>53.46</td><td>1.16e-4</td></tr><tr><td>10,000 AVLTree add randomly</td><td>24.45</td><td>40.91</td><td>2.06e-4</td></tr><tr><td>10,000 AVLTree get randomly</td><td>9.77</td><td>102.34</td><td>1.09e-4</td></tr><tr><td>10,000 AVLTree add & delete randomly</td><td>45.71</td><td>21.88</td><td>4.07e-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 RBTree add randomly</td><td>6.91</td><td>144.82</td><td>1.13e-4</td></tr><tr><td>10,000 RBTree get randomly</td><td>9.08</td><td>110.14</td><td>7.72e-5</td></tr><tr><td>10,000 RBTree add & delete randomly</td><td>18.97</td><td>52.71</td><td>8.49e-4</td></tr><tr><td>10,000 AVLTree add randomly</td><td>24.97</td><td>40.05</td><td>4.34e-4</td></tr><tr><td>10,000 AVLTree get randomly</td><td>9.95</td><td>100.47</td><td>0.00</td></tr><tr><td>10,000 AVLTree add & delete randomly</td><td>45.96</td><td>21.76</td><td>5.77e-4</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>9817.83</td><td>9.67e-7</td></tr><tr><td>1,000 addEdge</td><td>6.18</td><td>161.72</td><td>1.55e-4</td></tr><tr><td>1,000 getVertex</td><td>0.04</td><td>2.51e+4</td><td>5.08e-7</td></tr><tr><td>1,000 getEdge</td><td>22.82</td><td>43.82</td><td>0.00</td></tr><tr><td>tarjan</td><td>211.73</td><td>4.72</td><td>0.02</td></tr><tr><td>topologicalSort</td><td>188.71</td><td>5.30</td><td>0.02</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.10</td><td>9730.42</td><td>1.39e-6</td></tr><tr><td>1,000 addEdge</td><td>6.01</td><td>166.32</td><td>9.47e-5</td></tr><tr><td>1,000 getVertex</td><td>0.04</td><td>2.59e+4</td><td>3.52e-7</td></tr><tr><td>1,000 getEdge</td><td>23.80</td><td>42.03</td><td>0.00</td></tr><tr><td>tarjan</td><td>215.66</td><td>4.64</td><td>0.01</td></tr><tr><td>topologicalSort</td><td>187.85</td><td>5.32</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'>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 push</td><td>212.17</td><td>4.71</td><td>0.03</td></tr><tr><td>1,000,000 unshift</td><td>210.09</td><td>4.76</td><td>0.03</td></tr><tr><td>1,000,000 unshift & shift</td><td>213.41</td><td>4.69</td><td>0.07</td></tr><tr><td>1,000,000 addBefore</td><td>320.83</td><td>3.12</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 push</td><td>197.45</td><td>5.06</td><td>0.03</td></tr><tr><td>1,000,000 unshift</td><td>214.02</td><td>4.67</td><td>0.08</td></tr><tr><td>1,000,000 unshift & shift</td><td>198.97</td><td>5.03</td><td>0.05</td></tr><tr><td>1,000,000 addBefore</td><td>315.44</td><td>3.17</td><td>0.05</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>1,000,000 push & shift</td><td>205.40</td><td>4.87</td><td>0.05</td></tr><tr><td>10,000 push & pop</td><td>220.93</td><td>4.53</td><td>0.00</td></tr><tr><td>10,000 addBefore</td><td>248.19</td><td>4.03</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 & shift</td><td>196.91</td><td>5.08</td><td>0.04</td></tr><tr><td>10,000 push & pop</td><td>222.29</td><td>4.50</td><td>0.01</td></tr><tr><td>10,000 addBefore</td><td>248.87</td><td>4.02</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'>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>100,000 add</td><td>27.55</td><td>36.30</td><td>9.81e-4</td></tr><tr><td>100,000 add & poll</td><td>76.26</td><td>13.11</td><td>6.92e-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>100,000 add</td><td>27.69</td><td>36.11</td><td>8.96e-4</td></tr><tr><td>100,000 add & poll</td><td>75.38</td><td>13.27</td><td>6.45e-4</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>39.19</td><td>25.52</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>44.90</td><td>22.27</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>39.19</td><td>25.52</td><td>0.00</td></tr><tr><td>1,000,000 push & pop</td><td>45.24</td><td>22.10</td><td>0.00</td></tr></table></div>
</div>
[//]: # (No deletion!!! End of Replace Section)

52
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "data-structure-typed",
"version": "1.52.4",
"version": "1.52.6",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "data-structure-typed",
"version": "1.52.4",
"version": "1.52.6",
"license": "MIT",
"devDependencies": {
"@swc/core": "^1.3.96",
@ -16,11 +16,11 @@
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"auto-changelog": "^2.4.0",
"avl-tree-typed": "^1.52.3",
"avl-tree-typed": "^1.52.5",
"benchmark": "^2.1.4",
"binary-tree-typed": "^1.52.3",
"bst-typed": "^1.52.3",
"data-structure-typed": "^1.52.3",
"binary-tree-typed": "^1.52.5",
"bst-typed": "^1.52.5",
"data-structure-typed": "^1.52.5",
"dependency-cruiser": "^14.1.0",
"doctoc": "^2.2.1",
"eslint": "^8.50.0",
@ -29,7 +29,7 @@
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"fast-glob": "^3.3.1",
"heap-typed": "^1.52.3",
"heap-typed": "^1.52.5",
"istanbul-badges-readme": "^1.8.5",
"jest": "^29.7.0",
"js-sdsl": "^4.4.2",
@ -3331,13 +3331,13 @@
}
},
"node_modules/avl-tree-typed": {
"version": "1.52.3",
"resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.52.3.tgz",
"integrity": "sha512-r+SKVutucbF9VLDTRxthCZXAtKa1gXVsWgz2/0JISW7gZ09IfhND1Sj40LwivQSACU2YxfsVPcNFs2AnaDXz2g==",
"version": "1.52.5",
"resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.52.5.tgz",
"integrity": "sha512-vyIoFiP73qDNTLkTreE8FCzwVhEMm0XlAHvIHKGwbX2OFVPoS84wnrbKOWhz5XGtX+/NeQm9eJkEORnFWGGFHg==",
"dev": true,
"license": "MIT",
"dependencies": {
"data-structure-typed": "^1.52.3"
"data-structure-typed": "^1.52.5"
}
},
"node_modules/babel-jest": {
@ -3562,13 +3562,13 @@
}
},
"node_modules/binary-tree-typed": {
"version": "1.52.3",
"resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.52.3.tgz",
"integrity": "sha512-mozUp3u+iHym8EhpUL+CyvRil9ZgDrKEwE0d/E8CKiS7XggWTjNVIXPOxGBB4vNFPbmOf+PaMdVivncr9nEQGQ==",
"version": "1.52.5",
"resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.52.5.tgz",
"integrity": "sha512-RlJCcnaq0w1M/X92Z20DbnDVY09QE6+5bvyZzI3pB2EvUSyXDiTiyJI4c9S3GtkXDg3jaMGGGPp4wfkkDcVXgQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"data-structure-typed": "^1.52.3"
"data-structure-typed": "^1.52.5"
}
},
"node_modules/brace-expansion": {
@ -3651,13 +3651,13 @@
}
},
"node_modules/bst-typed": {
"version": "1.52.3",
"resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.52.3.tgz",
"integrity": "sha512-fJLUL5O7+5ozB5bb0tkRAvxiB4Ldmgr7yVTBjTS8w2TbBCafT4viYJ2H+1rrAhgR6mHgHt+8w20O7emzCwkacA==",
"version": "1.52.5",
"resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.52.5.tgz",
"integrity": "sha512-wl3iu4bPEdd3f25AlrlkPyCl1COAN7LkxJ+mTJqvRoc7QM/wYK1r2/YETnkPAWO16HEK6GMRKiroIb16BFwVaQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"data-structure-typed": "^1.52.3"
"data-structure-typed": "^1.52.5"
}
},
"node_modules/buffer-from": {
@ -4141,9 +4141,9 @@
}
},
"node_modules/data-structure-typed": {
"version": "1.52.3",
"resolved": "https://registry.npmjs.org/data-structure-typed/-/data-structure-typed-1.52.3.tgz",
"integrity": "sha512-7TGeW3NN3WT+lPH+//B7W8QPV81jtzuDy+lGGsyOe9vNikWt5NjEWmdDXreLg0T6EPbDG12LEp6f2lafUaYwCw==",
"version": "1.52.5",
"resolved": "https://registry.npmjs.org/data-structure-typed/-/data-structure-typed-1.52.5.tgz",
"integrity": "sha512-nWI6dUp3teOmGf1D9hZVhekNBYb2ZMZxAgSX2lKvXUWuuEsd5GBu6uMFO5Vn+3I/f0nHCNptjq9c5WTK9dEycg==",
"dev": true,
"license": "MIT"
},
@ -6008,13 +6008,13 @@
}
},
"node_modules/heap-typed": {
"version": "1.52.3",
"resolved": "https://registry.npmjs.org/heap-typed/-/heap-typed-1.52.3.tgz",
"integrity": "sha512-G2PQwpAVfJBO2/C+398n6BPXxE5HZm/aKY9rqkkDWB1jdzyAvMQxy+bELrjP0or0KJAFw7vrgcm2x23Ox7Ul1g==",
"version": "1.52.5",
"resolved": "https://registry.npmjs.org/heap-typed/-/heap-typed-1.52.5.tgz",
"integrity": "sha512-qW7dNZxquHbm73fVw4dRWy/nZIY8XiFpx24hXslHw364QATAc3eZ9CAAtlzFgh3fteMzAb8iMzkVND/NCUr48w==",
"dev": true,
"license": "MIT",
"dependencies": {
"data-structure-typed": "^1.52.3"
"data-structure-typed": "^1.52.5"
}
},
"node_modules/html-escaper": {

View file

@ -1,6 +1,6 @@
{
"name": "data-structure-typed",
"version": "1.52.5",
"version": "1.52.6",
"description": "Javascript Data Structure. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree(BST), AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack. Benchmark compared with C++ STL. API aligned with ES6 and Java.util. Usability is comparable to Python",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
@ -66,11 +66,11 @@
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"auto-changelog": "^2.4.0",
"avl-tree-typed": "^1.52.3",
"avl-tree-typed": "^1.52.5",
"benchmark": "^2.1.4",
"binary-tree-typed": "^1.52.3",
"bst-typed": "^1.52.3",
"data-structure-typed": "^1.52.3",
"binary-tree-typed": "^1.52.5",
"bst-typed": "^1.52.5",
"data-structure-typed": "^1.52.5",
"dependency-cruiser": "^14.1.0",
"doctoc": "^2.2.1",
"eslint": "^8.50.0",
@ -79,7 +79,7 @@
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"fast-glob": "^3.3.1",
"heap-typed": "^1.52.3",
"heap-typed": "^1.52.5",
"istanbul-badges-readme": "^1.8.5",
"jest": "^29.7.0",
"js-sdsl": "^4.4.2",

View file

@ -335,7 +335,7 @@ export class BinaryTree<
* @returns a boolean value.
*/
isRealNodeOrNull(node: R | BTNKeyOrNodeOrEntry<K, V, NODE>): node is NODE | null {
return this.isRealNode(node) || node === null;
return node === null || this.isRealNode(node);
}
/**
@ -1843,7 +1843,7 @@ export class BinaryTree<
if (includeNull) return this.isRealNodeOrNull(node);
return this.isRealNode(node);
},
shouldProcessRoot: (node: OptBTNOrNull<NODE>) => boolean = node => true
shouldProcessRoot: (node: OptBTNOrNull<NODE>) => boolean = node => this.isRealNodeOrNull(node)
): ReturnType<C>[] {
beginRoot = this.ensureNode(beginRoot);
if (!beginRoot) return [];

View file

@ -12,6 +12,7 @@ export class TreeNode<V = any> {
constructor(key: string, value?: V, children?: TreeNode<V>[]) {
this._key = key;
this._value = value || undefined;
if (children) this._children = children;
}
protected _key: string;

View file

@ -19,7 +19,7 @@ describe('AVL Tree Test from data-structure-typed', () => {
expect(getMinNodeByRoot?.key).toBe(1);
const node15 = tree.getNode(15);
const getMinNodeBySpecificNode = node15 && tree.getLeftMost(node15);
const getMinNodeBySpecificNode = node15 && tree.getLeftMost(node => node, node15);
expect(getMinNodeBySpecificNode?.key).toBe(12);
let subTreeSum = 0;

View file

@ -36,7 +36,7 @@ describe('AVL Tree Test', () => {
expect(getMinNodeByRoot?.key).toBe(1);
const node15 = tree.getNode(15);
const getMinNodeBySpecificNode = node15 && tree.getLeftMost(node15);
const getMinNodeBySpecificNode = node15 && tree.getLeftMost(node => node, node15);
expect(getMinNodeBySpecificNode?.key).toBe(12);
let subTreeSum = 0;

View file

@ -30,7 +30,7 @@ describe('Individual package BST operations test', () => {
expect(leftMost?.key).toBe(1);
const node15 = bst.getNode(15);
const minNodeBySpecificNode = node15 && bst.getLeftMost(node15);
const minNodeBySpecificNode = node15 && bst.getLeftMost(node => node, node15);
expect(minNodeBySpecificNode?.key).toBe(12);
let subTreeSum = 0;
@ -230,7 +230,7 @@ describe('Individual package BST operations test', () => {
key: 15,
keyA: 15
});
const minNodeBySpecificNode = node15 && objBST.getLeftMost(node15);
const minNodeBySpecificNode = node15 && objBST.getLeftMost(node => node, node15);
expect(minNodeBySpecificNode?.key).toBe(12);
let subTreeSum = 0;

View file

@ -848,110 +848,100 @@ describe('BinaryTree toEntryFn', () => {
});
describe('BinaryTree traversals', () => {
const tree = new BinaryTree<number>();
it('traversals', () => {
const tree = new BinaryTree<number>();
const arr = [35, 20, 40, 15, 29, null, 50, null, 16, 28, 30, 45, 55];
tree.refill(arr);
expect(tree.bfs(node => node, tree.root, 'ITERATIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
40,
15,
29,
null,
50,
null,
16,
28,
30,
45,
55
]);
expect(tree.bfs(node => node, tree.root, 'RECURSIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
40,
15,
29,
null,
50,
null,
16,
28,
30,
45,
55
]);
expect(tree.bfs(node => node, tree.root, 'ITERATIVE').map(node => (node === null ? null : node.key))).toEqual([
35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55
]);
expect(tree.bfs(node => node, tree.root, 'RECURSIVE').map(node => (node === null ? null : node.key))).toEqual([
35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55
]);
const arr = [35, 20, 40, 15, 29, null, 50, null, 16, 28, 30, 45, 55];
tree.refill(arr);
expect(tree.bfs(node => node, tree.root, 'ITERATIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
40,
15,
29,
null,
50,
null,
16,
28,
30,
45,
55
]);
expect(tree.bfs(node => node, tree.root, 'RECURSIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
40,
15,
29,
null,
50,
null,
16,
28,
30,
45,
55
]);
expect(tree.bfs(node => node, tree.root, 'ITERATIVE').map(node => (node === null ? null : node.key))).toEqual([
35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55
]);
expect(tree.bfs(node => node, tree.root, 'RECURSIVE').map(node => (node === null ? null : node.key))).toEqual([
35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55
]);
expect(tree.dfs(node => node.key, 'PRE')).toEqual([35, 20, 15, 16, 29, 28, 30, 40, 50, 45, 55]);
expect(tree.dfs(node => node.key, 'PRE', tree.root, 'RECURSIVE')).toEqual([
35, 20, 15, 16, 29, 28, 30, 40, 50, 45, 55
]);
expect(tree.dfs(node => node, 'PRE', tree.root, 'ITERATIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
15,
null,
16,
29,
28,
30,
40,
null,
50,
45,
55
]);
expect(tree.dfs(node => node, 'PRE', tree.root, 'RECURSIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
15,
null,
16,
29,
28,
30,
40,
null,
50,
45,
55
]);
expect(tree.dfs(node => node.key, 'PRE')).toEqual([35, 20, 15, 16, 29, 28, 30, 40, 50, 45, 55]);
expect(tree.dfs(node => node.key, 'PRE', tree.root, 'RECURSIVE')).toEqual([
35, 20, 15, 16, 29, 28, 30, 40, 50, 45, 55
]);
expect(
tree.dfs(node => node, 'PRE', tree.root, 'ITERATIVE', true).map(node => (node === null ? null : node.key))
).toEqual([35, 20, 15, null, 16, 29, 28, 30, 40, null, 50, 45, 55]);
expect(tree.dfs(node => node, 'PRE', tree.root, 'RECURSIVE', true).map(node => (node ? node.key : null))).toEqual([
35,
20,
15,
null,
16,
29,
28,
30,
40,
null,
50,
45,
55
]);
expect(tree.dfs(node => node.key, 'IN')).toEqual([15, 16, 20, 28, 29, 30, 35, 40, 45, 50, 55]);
expect(tree.dfs(node => node.key, 'POST')).toEqual([16, 15, 28, 30, 29, 20, 45, 55, 50, 40, 35]);
expect(tree.dfs(node => node.key, 'POST', tree.root, 'RECURSIVE')).toEqual([
16, 15, 28, 30, 29, 20, 45, 55, 50, 40, 35
]);
expect(tree.bfs(node => node.key, tree.root, 'RECURSIVE')).toEqual([35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55]);
expect(tree.bfs(node => node.key, tree.root, 'ITERATIVE')).toEqual([35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55]);
expect(tree.dfs(node => node.key, 'IN')).toEqual([15, 16, 20, 28, 29, 30, 35, 40, 45, 50, 55]);
expect(tree.dfs(node => node.key, 'POST')).toEqual([16, 15, 28, 30, 29, 20, 45, 55, 50, 40, 35]);
expect(tree.dfs(node => node.key, 'POST', tree.root, 'RECURSIVE')).toEqual([
16, 15, 28, 30, 29, 20, 45, 55, 50, 40, 35
]);
expect(tree.bfs(node => node.key, tree.root, 'RECURSIVE')).toEqual([35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55]);
expect(tree.bfs(node => node.key, tree.root, 'ITERATIVE')).toEqual([35, 20, 40, 15, 29, 50, 16, 28, 30, 45, 55]);
expect(tree.listLevels(node => node.key)).toEqual([[35], [20, 40], [15, 29, 50], [16, 28, 30, 45, 55]]);
expect(tree.listLevels(node => node.key)).toEqual([[35], [20, 40], [15, 29, 50], [16, 28, 30, 45, 55]]);
expect(tree.listLevels(node => node.key, tree.root, 'RECURSIVE')).toEqual([
[35],
[20, 40],
[15, 29, 50],
[16, 28, 30, 45, 55]
]);
expect(tree.listLevels(node => (node ? node.key : null), tree.root, 'ITERATIVE', true)).toEqual([
[35],
[20, 40],
[15, 29, null, 50],
[null, 16, 28, 30, 45, 55]
]);
expect(tree.listLevels(node => (node ? node.key : null), tree.root, 'RECURSIVE', true)).toEqual([
[35],
[20, 40],
[15, 29, null, 50],
[null, 16, 28, 30, 45, 55]
]);
expect(tree.listLevels(node => node.key, tree.root, 'RECURSIVE')).toEqual([
[35],
[20, 40],
[15, 29, 50],
[16, 28, 30, 45, 55]
]);
expect(tree.listLevels(node => (node ? node.key : null), tree.root, 'ITERATIVE', true)).toEqual([
[35],
[20, 40],
[15, 29, null, 50],
[null, 16, 28, 30, 45, 55]
]);
expect(tree.listLevels(node => (node ? node.key : null), tree.root, 'RECURSIVE', true)).toEqual([
[35],
[20, 40],
[15, 29, null, 50],
[null, 16, 28, 30, 45, 55]
]);
});
});
describe('BinaryTree', () => {