diff --git a/CHANGELOG.md b/CHANGELOG.md
index fef9aee..b112baf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.42.1](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
+## [v1.42.2](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
### Changes
diff --git a/README.md b/README.md
index f26e3de..853d220 100644
--- a/README.md
+++ b/README.md
@@ -636,40 +636,40 @@ optimal approach to data structure design.
[//]: # (Start of Replace Section)
avl-tree
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 add randomly | 30.74 | 32.53 | 7.33e-4 |
10,000 add & delete randomly | 67.99 | 14.71 | 0.00 |
10,000 addMany | 39.82 | 25.11 | 4.59e-4 |
10,000 get | 26.70 | 37.46 | 2.61e-4 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 add randomly | 31.93 | 31.32 | 2.30e-4 |
10,000 add & delete randomly | 69.12 | 14.47 | 0.00 |
10,000 addMany | 41.14 | 24.31 | 1.60e-4 |
10,000 get | 28.68 | 34.86 | 7.65e-4 |
binary-tree
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000 add randomly | 12.91 | 77.44 | 5.52e-4 |
1,000 add & delete randomly | 15.90 | 62.88 | 1.24e-4 |
1,000 addMany | 10.72 | 93.27 | 1.52e-4 |
1,000 get | 18.39 | 54.39 | 2.28e-4 |
1,000 dfs | 71.58 | 13.97 | 0.00 |
1,000 bfs | 57.62 | 17.35 | 0.00 |
1,000 morris | 37.17 | 26.90 | 2.13e-4 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000 add randomly | 13.12 | 76.21 | 3.40e-4 |
1,000 add & delete randomly | 16.33 | 61.22 | 4.17e-4 |
1,000 addMany | 10.96 | 91.22 | 3.99e-4 |
1,000 get | 18.65 | 53.63 | 4.20e-4 |
1,000 dfs | 71.82 | 13.92 | 0.00 |
1,000 bfs | 58.95 | 16.96 | 0.00 |
1,000 morris | 37.46 | 26.70 | 4.60e-4 |
bst
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 add randomly | 30.50 | 32.79 | 0.00 |
10,000 add & delete randomly | 68.35 | 14.63 | 8.92e-4 |
10,000 addMany | 29.41 | 34.00 | 9.96e-4 |
10,000 get | 28.27 | 35.37 | 5.46e-4 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 add randomly | 32.98 | 30.32 | 0.00 |
10,000 add & delete randomly | 74.47 | 13.43 | 0.00 |
10,000 addMany | 29.93 | 33.41 | 6.02e-4 |
10,000 get | 29.92 | 33.42 | 8.61e-4 |
rb-tree
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 add randomly | 82.19 | 12.17 | 0.01 |
100,000 add & 1000 delete randomly | 99.74 | 10.03 | 0.03 |
100,000 getNode | 78.27 | 12.78 | 0.04 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 add randomly | 80.49 | 12.42 | 0.01 |
100,000 add & 1000 delete randomly | 89.97 | 11.11 | 0.01 |
100,000 getNode | 68.63 | 14.57 | 0.01 |
directed-graph
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000 addVertex | 0.10 | 9687.71 | 1.14e-5 |
1,000 addEdge | 7.42 | 134.68 | 0.00 |
1,000 getVertex | 0.05 | 2.05e+4 | 9.33e-6 |
1,000 getEdge | 20.29 | 49.29 | 0.00 |
tarjan | 190.48 | 5.25 | 0.01 |
tarjan all | 190.72 | 5.24 | 0.00 |
topologicalSort | 161.21 | 6.20 | 0.02 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000 addVertex | 0.10 | 9878.72 | 1.87e-6 |
1,000 addEdge | 6.34 | 157.78 | 2.53e-4 |
1,000 getVertex | 0.05 | 2.12e+4 | 1.05e-6 |
1,000 getEdge | 23.08 | 43.33 | 0.00 |
tarjan | 217.75 | 4.59 | 0.01 |
tarjan all | 219.23 | 4.56 | 0.01 |
topologicalSort | 175.73 | 5.69 | 0.02 |
heap
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 add & pop | 4.70 | 212.55 | 5.89e-4 |
10,000 fib add & pop | 366.96 | 2.73 | 0.02 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 add & pop | 4.64 | 215.44 | 6.89e-5 |
10,000 fib add & pop | 357.37 | 2.80 | 0.01 |
doubly-linked-list
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000,000 unshift | 226.42 | 4.42 | 0.04 |
1,000,000 unshift & shift | 163.14 | 6.13 | 0.01 |
1,000,000 insertBefore | 343.18 | 2.91 | 0.08 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000,000 unshift | 239.34 | 4.18 | 0.04 |
1,000,000 unshift & shift | 168.74 | 5.93 | 0.04 |
1,000,000 insertBefore | 324.74 | 3.08 | 0.06 |
singly-linked-list
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 push & pop | 217.34 | 4.60 | 0.01 |
10,000 insertBefore | 248.51 | 4.02 | 0.00 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 push & pop | 213.86 | 4.68 | 0.01 |
10,000 insertBefore | 254.02 | 3.94 | 0.02 |
max-priority-queue
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 refill & poll | 11.65 | 85.81 | 3.52e-4 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
10,000 refill & poll | 11.39 | 87.76 | 2.14e-4 |
deque
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000,000 push | 224.57 | 4.45 | 0.04 |
1,000,000 shift | 25.15 | 39.77 | 0.00 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000,000 push | 233.91 | 4.28 | 0.05 |
1,000,000 shift | 25.61 | 39.05 | 0.00 |
queue
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000,000 push | 43.52 | 22.98 | 0.01 |
1,000,000 push & shift | 79.71 | 12.55 | 0.00 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
1,000,000 push | 43.88 | 22.79 | 0.01 |
1,000,000 push & shift | 81.71 | 12.24 | 0.00 |
trie
-
test name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 push | 59.28 | 16.87 | 0.00 |
100,000 getWords | 106.79 | 9.36 | 0.00 |
+
test name | time taken (ms) | executions per sec | sample deviation |
---|
100,000 push | 59.93 | 16.69 | 0.01 |
100,000 getWords | 93.10 | 10.74 | 0.01 |
[//]: # (End of Replace Section)
\ No newline at end of file
diff --git a/package.json b/package.json
index 4690f56..b47f4f6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "data-structure-typed",
- "version": "1.42.1",
+ "version": "1.42.2",
"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",
diff --git a/test/unit/data-structures/binary-tree/bst.test.ts b/test/unit/data-structures/binary-tree/bst.test.ts
index 0d9b295..9540831 100644
--- a/test/unit/data-structures/binary-tree/bst.test.ts
+++ b/test/unit/data-structures/binary-tree/bst.test.ts
@@ -837,4 +837,14 @@ describe('BST Performance test', function () {
bst.addMany([9, 8, 7, 3, 1, 2, 5, 4, 6], undefined, false);
expect(bst.lastKey()).toBe(9);
});
+
+
+ it('should subTreeTraverse, null should be ignored', () => {
+ const bst = new BST();
+ bst.addMany([4, 2, 6, null, 1, 3, null, 5, null, 7]);
+ expect(bst.subTreeTraverse(node => node.key, bst.getNode(6), IterationType.ITERATIVE)).toEqual([6,5, 7]);
+ expect(bst.subTreeTraverse(node => node.key, bst.getNode(6), IterationType.RECURSIVE)).toEqual([6,5, 7]);
+ expect(bst.subTreeTraverse(node => node === null ? null : node.key, bst.getNode(6), IterationType.ITERATIVE, true)).toEqual([6, 5, 7]);
+ expect(bst.subTreeTraverse(node => node === null ? null : node.key, bst.getNode(6), IterationType.RECURSIVE, true)).toEqual([6, 5, 7]);
+ });
});