tree-set-typed 2.3.0
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/.eslintrc.js +61 -0
- package/.prettierignore +6 -0
- package/.prettierrc.js +16 -0
- package/LICENSE +21 -0
- package/README.md +482 -0
- package/coverage/clover.xml +13 -0
- package/coverage/coverage-final.json +96 -0
- package/coverage/coverage-summary.json +60 -0
- package/coverage/lcov-report/base.css +403 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +119 -0
- package/coverage/lcov-report/index.ts.html +109 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +206 -0
- package/coverage/lcov.info +14 -0
- package/dist/cjs/index.cjs +12 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs-legacy/index.cjs +12 -0
- package/dist/cjs-legacy/index.cjs.map +1 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm-legacy/index.mjs +3 -0
- package/dist/esm-legacy/index.mjs.map +1 -0
- package/dist/types/common/index.d.ts +12 -0
- package/dist/types/constants/index.d.ts +4 -0
- package/dist/types/data-structures/base/index.d.ts +2 -0
- package/dist/types/data-structures/base/iterable-element-base.d.ts +219 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +150 -0
- package/dist/types/data-structures/base/linear-base.d.ts +335 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +236 -0
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +197 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +440 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +174 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +807 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +645 -0
- package/dist/types/data-structures/binary-tree/index.d.ts +10 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +312 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +160 -0
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +243 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +333 -0
- package/dist/types/data-structures/graph/abstract-graph.d.ts +340 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +332 -0
- package/dist/types/data-structures/graph/index.d.ts +4 -0
- package/dist/types/data-structures/graph/map-graph.d.ts +78 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +347 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +428 -0
- package/dist/types/data-structures/hash/index.d.ts +1 -0
- package/dist/types/data-structures/heap/heap.d.ts +552 -0
- package/dist/types/data-structures/heap/index.d.ts +3 -0
- package/dist/types/data-structures/heap/max-heap.d.ts +32 -0
- package/dist/types/data-structures/heap/min-heap.d.ts +33 -0
- package/dist/types/data-structures/index.d.ts +12 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +437 -0
- package/dist/types/data-structures/linked-list/index.d.ts +3 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +567 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +27 -0
- package/dist/types/data-structures/matrix/index.d.ts +2 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +168 -0
- package/dist/types/data-structures/matrix/navigator.d.ts +55 -0
- package/dist/types/data-structures/priority-queue/index.d.ts +3 -0
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +27 -0
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +26 -0
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +15 -0
- package/dist/types/data-structures/queue/deque.d.ts +459 -0
- package/dist/types/data-structures/queue/index.d.ts +2 -0
- package/dist/types/data-structures/queue/queue.d.ts +364 -0
- package/dist/types/data-structures/stack/index.d.ts +1 -0
- package/dist/types/data-structures/stack/stack.d.ts +324 -0
- package/dist/types/data-structures/tree/index.d.ts +1 -0
- package/dist/types/data-structures/tree/tree.d.ts +62 -0
- package/dist/types/data-structures/trie/index.d.ts +1 -0
- package/dist/types/data-structures/trie/trie.d.ts +412 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/interfaces/binary-tree.d.ts +60 -0
- package/dist/types/interfaces/doubly-linked-list.d.ts +1 -0
- package/dist/types/interfaces/graph.d.ts +21 -0
- package/dist/types/interfaces/heap.d.ts +1 -0
- package/dist/types/interfaces/index.d.ts +8 -0
- package/dist/types/interfaces/navigator.d.ts +1 -0
- package/dist/types/interfaces/priority-queue.d.ts +1 -0
- package/dist/types/interfaces/segment-tree.d.ts +1 -0
- package/dist/types/interfaces/singly-linked-list.d.ts +1 -0
- package/dist/types/types/common.d.ts +15 -0
- package/dist/types/types/data-structures/base/base.d.ts +13 -0
- package/dist/types/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
- package/dist/types/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -0
- package/dist/types/types/data-structures/binary-tree/avl-tree.d.ts +2 -0
- package/dist/types/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +12 -0
- package/dist/types/types/data-structures/binary-tree/index.d.ts +9 -0
- package/dist/types/types/data-structures/binary-tree/red-black-tree.d.ts +3 -0
- package/dist/types/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -0
- package/dist/types/types/data-structures/graph/abstract-graph.d.ts +14 -0
- package/dist/types/types/data-structures/graph/directed-graph.d.ts +1 -0
- package/dist/types/types/data-structures/graph/index.d.ts +3 -0
- package/dist/types/types/data-structures/graph/map-graph.d.ts +1 -0
- package/dist/types/types/data-structures/graph/undirected-graph.d.ts +1 -0
- package/dist/types/types/data-structures/hash/hash-map.d.ts +19 -0
- package/dist/types/types/data-structures/hash/index.d.ts +2 -0
- package/dist/types/types/data-structures/heap/heap.d.ts +5 -0
- package/dist/types/types/data-structures/heap/index.d.ts +1 -0
- package/dist/types/types/data-structures/heap/max-heap.d.ts +1 -0
- package/dist/types/types/data-structures/heap/min-heap.d.ts +1 -0
- package/dist/types/types/data-structures/index.d.ts +12 -0
- package/dist/types/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -0
- package/dist/types/types/data-structures/linked-list/index.d.ts +3 -0
- package/dist/types/types/data-structures/linked-list/singly-linked-list.d.ts +2 -0
- package/dist/types/types/data-structures/linked-list/skip-linked-list.d.ts +4 -0
- package/dist/types/types/data-structures/matrix/index.d.ts +2 -0
- package/dist/types/types/data-structures/matrix/matrix.d.ts +7 -0
- package/dist/types/types/data-structures/matrix/navigator.d.ts +14 -0
- package/dist/types/types/data-structures/priority-queue/index.d.ts +3 -0
- package/dist/types/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +2 -0
- package/dist/types/types/data-structures/queue/deque.d.ts +4 -0
- package/dist/types/types/data-structures/queue/index.d.ts +2 -0
- package/dist/types/types/data-structures/queue/queue.d.ts +4 -0
- package/dist/types/types/data-structures/stack/index.d.ts +1 -0
- package/dist/types/types/data-structures/stack/stack.d.ts +2 -0
- package/dist/types/types/data-structures/tree/index.d.ts +1 -0
- package/dist/types/types/data-structures/tree/tree.d.ts +1 -0
- package/dist/types/types/data-structures/trie/index.d.ts +1 -0
- package/dist/types/types/data-structures/trie/trie.d.ts +4 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/utils/index.d.ts +2 -0
- package/dist/types/types/utils/utils.d.ts +22 -0
- package/dist/types/types/utils/validate-type.d.ts +19 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/number.d.ts +14 -0
- package/dist/types/utils/utils.d.ts +209 -0
- package/dist/umd/red-black-tree-typed.js +14578 -0
- package/dist/umd/red-black-tree-typed.js.map +1 -0
- package/dist/umd/red-black-tree-typed.min.js +44 -0
- package/dist/umd/red-black-tree-typed.min.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1383 -0
- package/docs/classes/AVLTree.html +2046 -0
- package/docs/classes/AVLTreeNode.html +263 -0
- package/docs/index.html +523 -0
- package/docs/modules.html +45 -0
- package/jest.config.js +8 -0
- package/package.json +113 -0
- package/src/common/index.ts +23 -0
- package/src/constants/index.ts +4 -0
- package/src/data-structures/base/index.ts +2 -0
- package/src/data-structures/base/iterable-element-base.ts +352 -0
- package/src/data-structures/base/iterable-entry-base.ts +246 -0
- package/src/data-structures/base/linear-base.ts +643 -0
- package/src/data-structures/binary-tree/avl-tree-counter.ts +539 -0
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +438 -0
- package/src/data-structures/binary-tree/avl-tree.ts +840 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +331 -0
- package/src/data-structures/binary-tree/binary-tree.ts +2492 -0
- package/src/data-structures/binary-tree/bst.ts +2024 -0
- package/src/data-structures/binary-tree/index.ts +10 -0
- package/src/data-structures/binary-tree/red-black-tree.ts +767 -0
- package/src/data-structures/binary-tree/segment-tree.ts +324 -0
- package/src/data-structures/binary-tree/tree-counter.ts +575 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +549 -0
- package/src/data-structures/graph/abstract-graph.ts +1081 -0
- package/src/data-structures/graph/directed-graph.ts +715 -0
- package/src/data-structures/graph/index.ts +4 -0
- package/src/data-structures/graph/map-graph.ts +132 -0
- package/src/data-structures/graph/undirected-graph.ts +626 -0
- package/src/data-structures/hash/hash-map.ts +813 -0
- package/src/data-structures/hash/index.ts +1 -0
- package/src/data-structures/heap/heap.ts +1020 -0
- package/src/data-structures/heap/index.ts +3 -0
- package/src/data-structures/heap/max-heap.ts +47 -0
- package/src/data-structures/heap/min-heap.ts +36 -0
- package/src/data-structures/index.ts +12 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +876 -0
- package/src/data-structures/linked-list/index.ts +3 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +1050 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +173 -0
- package/src/data-structures/matrix/index.ts +2 -0
- package/src/data-structures/matrix/matrix.ts +491 -0
- package/src/data-structures/matrix/navigator.ts +124 -0
- package/src/data-structures/priority-queue/index.ts +3 -0
- package/src/data-structures/priority-queue/max-priority-queue.ts +42 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +29 -0
- package/src/data-structures/priority-queue/priority-queue.ts +19 -0
- package/src/data-structures/queue/deque.ts +1001 -0
- package/src/data-structures/queue/index.ts +2 -0
- package/src/data-structures/queue/queue.ts +592 -0
- package/src/data-structures/stack/index.ts +1 -0
- package/src/data-structures/stack/stack.ts +469 -0
- package/src/data-structures/tree/index.ts +1 -0
- package/src/data-structures/tree/tree.ts +115 -0
- package/src/data-structures/trie/index.ts +1 -0
- package/src/data-structures/trie/trie.ts +756 -0
- package/src/index.ts +24 -0
- package/src/interfaces/binary-tree.ts +252 -0
- package/src/interfaces/doubly-linked-list.ts +1 -0
- package/src/interfaces/graph.ts +44 -0
- package/src/interfaces/heap.ts +1 -0
- package/src/interfaces/index.ts +8 -0
- package/src/interfaces/navigator.ts +1 -0
- package/src/interfaces/priority-queue.ts +1 -0
- package/src/interfaces/segment-tree.ts +1 -0
- package/src/interfaces/singly-linked-list.ts +1 -0
- package/src/types/common.ts +25 -0
- package/src/types/data-structures/base/base.ts +34 -0
- package/src/types/data-structures/base/index.ts +1 -0
- package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +3 -0
- package/src/types/data-structures/binary-tree/avl-tree.ts +3 -0
- package/src/types/data-structures/binary-tree/binary-indexed-tree.ts +1 -0
- package/src/types/data-structures/binary-tree/binary-tree.ts +31 -0
- package/src/types/data-structures/binary-tree/bst.ts +19 -0
- package/src/types/data-structures/binary-tree/index.ts +9 -0
- package/src/types/data-structures/binary-tree/red-black-tree.ts +5 -0
- package/src/types/data-structures/binary-tree/segment-tree.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +3 -0
- package/src/types/data-structures/graph/abstract-graph.ts +18 -0
- package/src/types/data-structures/graph/directed-graph.ts +2 -0
- package/src/types/data-structures/graph/index.ts +3 -0
- package/src/types/data-structures/graph/map-graph.ts +1 -0
- package/src/types/data-structures/graph/undirected-graph.ts +1 -0
- package/src/types/data-structures/hash/hash-map.ts +19 -0
- package/src/types/data-structures/hash/index.ts +3 -0
- package/src/types/data-structures/heap/heap.ts +6 -0
- package/src/types/data-structures/heap/index.ts +1 -0
- package/src/types/data-structures/heap/max-heap.ts +1 -0
- package/src/types/data-structures/heap/min-heap.ts +1 -0
- package/src/types/data-structures/index.ts +12 -0
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -0
- package/src/types/data-structures/linked-list/index.ts +3 -0
- package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -0
- package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
- package/src/types/data-structures/matrix/index.ts +2 -0
- package/src/types/data-structures/matrix/matrix.ts +7 -0
- package/src/types/data-structures/matrix/navigator.ts +14 -0
- package/src/types/data-structures/priority-queue/index.ts +3 -0
- package/src/types/data-structures/priority-queue/max-priority-queue.ts +1 -0
- package/src/types/data-structures/priority-queue/min-priority-queue.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +3 -0
- package/src/types/data-structures/queue/deque.ts +5 -0
- package/src/types/data-structures/queue/index.ts +2 -0
- package/src/types/data-structures/queue/queue.ts +5 -0
- package/src/types/data-structures/stack/index.ts +1 -0
- package/src/types/data-structures/stack/stack.ts +3 -0
- package/src/types/data-structures/tree/index.ts +1 -0
- package/src/types/data-structures/tree/tree.ts +1 -0
- package/src/types/data-structures/trie/index.ts +1 -0
- package/src/types/data-structures/trie/trie.ts +3 -0
- package/src/types/index.ts +3 -0
- package/src/types/utils/index.ts +2 -0
- package/src/types/utils/utils.ts +33 -0
- package/src/types/utils/validate-type.ts +35 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/number.ts +22 -0
- package/src/utils/utils.ts +350 -0
- package/test/index.test.ts +111 -0
- package/tsconfig.base.json +23 -0
- package/tsconfig.json +12 -0
- package/tsconfig.test.json +8 -0
- package/tsconfig.types.json +15 -0
- package/tsup.config.js +28 -0
- package/tsup.node.config.js +71 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'extends': [
|
|
3
|
+
'plugin:@typescript-eslint/recommended',
|
|
4
|
+
'prettier'
|
|
5
|
+
],
|
|
6
|
+
'rules': {
|
|
7
|
+
'import/no-anonymous-default-export': 'off',
|
|
8
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
9
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
10
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
11
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
12
|
+
// add new line above comment
|
|
13
|
+
'lines-around-comment': [
|
|
14
|
+
'error',
|
|
15
|
+
{
|
|
16
|
+
'beforeLineComment': false,
|
|
17
|
+
'beforeBlockComment': true,
|
|
18
|
+
'allowBlockStart': true,
|
|
19
|
+
'allowClassStart': true,
|
|
20
|
+
'allowObjectStart': true,
|
|
21
|
+
'allowArrayStart': true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
// add new line above return
|
|
25
|
+
'newline-before-return': 'off',
|
|
26
|
+
// add new line below import
|
|
27
|
+
'import/newline-after-import': [
|
|
28
|
+
'error',
|
|
29
|
+
{
|
|
30
|
+
'count': 1
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
'@typescript-eslint/ban-types': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
'extendDefaults': true,
|
|
37
|
+
'types': {
|
|
38
|
+
'{}': false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
'plugins': [
|
|
44
|
+
'import'
|
|
45
|
+
],
|
|
46
|
+
'settings': {
|
|
47
|
+
'import/parsers': {
|
|
48
|
+
'@typescript-eslint/parser': [
|
|
49
|
+
'.ts'
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
'import/resolver': {
|
|
53
|
+
'typescript': {
|
|
54
|
+
'alwaysTryTypes': true,
|
|
55
|
+
'project': [
|
|
56
|
+
'./tsconfig.json'
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/.prettierignore
ADDED
package/.prettierrc.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
arrowParens: 'avoid',
|
|
3
|
+
bracketSpacing: true,
|
|
4
|
+
htmlWhitespaceSensitivity: 'css',
|
|
5
|
+
insertPragma: false,
|
|
6
|
+
bracketSameLine: false,
|
|
7
|
+
jsxSingleQuote: true,
|
|
8
|
+
printWidth: 120,
|
|
9
|
+
proseWrap: 'preserve',
|
|
10
|
+
quoteProps: 'as-needed',
|
|
11
|
+
requirePragma: false,
|
|
12
|
+
singleQuote: true,
|
|
13
|
+
tabWidth: 2,
|
|
14
|
+
trailingComma: 'none',
|
|
15
|
+
useTabs: false
|
|
16
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
# What
|
|
10
|
+
|
|
11
|
+
## Brief
|
|
12
|
+
|
|
13
|
+
This is a standalone Red Black Tree data structure from the data-structure-typed collection. If you wish to access more data
|
|
14
|
+
structures or advanced features, you can transition to directly installing the
|
|
15
|
+
complete [data-structure-typed](https://www.npmjs.com/package/data-structure-typed) package
|
|
16
|
+
|
|
17
|
+
# How
|
|
18
|
+
|
|
19
|
+
## install
|
|
20
|
+
|
|
21
|
+
### npm
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i red-black-tree-typed --save
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### yarn
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn add red-black-tree-typed
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### snippet
|
|
35
|
+
|
|
36
|
+
#### TS
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import {RedBlackTree} from 'data-structure-typed';
|
|
40
|
+
// /* or if you prefer */ import {RedBlackTree} from 'red-black-tree-typed';
|
|
41
|
+
|
|
42
|
+
const rbTree = new RedBlackTree<number>();
|
|
43
|
+
|
|
44
|
+
const idsOrVals = [11, 3, 15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5];
|
|
45
|
+
rbTree.addMany(idsOrVals);
|
|
46
|
+
|
|
47
|
+
const node6 = rbTree.getNode(6);
|
|
48
|
+
node6 && rbTree.getHeight(node6) // 3
|
|
49
|
+
node6 && rbTree.getDepth(node6) // 1
|
|
50
|
+
const getNodeById = rbTree.getNodeByKey(10);
|
|
51
|
+
getNodeById?.id // 10
|
|
52
|
+
|
|
53
|
+
const getMinNodeByRoot = rbTree.getLeftMost();
|
|
54
|
+
getMinNodeByRoot?.id // 1
|
|
55
|
+
|
|
56
|
+
const node15 = rbTree.getNodeByKey(15);
|
|
57
|
+
const getMinNodeBySpecificNode = node15 && rbTree.getLeftMost(node15);
|
|
58
|
+
getMinNodeBySpecificNode?.id // 12
|
|
59
|
+
|
|
60
|
+
const lesserSum = rbTree.lesserSum(10);
|
|
61
|
+
lesserSum // 45
|
|
62
|
+
|
|
63
|
+
const node11 = rbTree.getNodeByKey(11);
|
|
64
|
+
node11?.id // 11
|
|
65
|
+
|
|
66
|
+
const dfs = rbTree.dfs('in');
|
|
67
|
+
dfs[0].id // 1
|
|
68
|
+
rbTree.perfectlyBalance();
|
|
69
|
+
const bfs = rbTree.bfs('node');
|
|
70
|
+
rbTree.isPerfectlyBalanced() && bfs[0].id // 8
|
|
71
|
+
|
|
72
|
+
rbTree.delete(11, true)[0].deleted?.id // 11
|
|
73
|
+
rbTree.isAVLBalanced(); // true
|
|
74
|
+
node15 && rbTree.getHeight(node15) // 2
|
|
75
|
+
rbTree.delete(1, true)[0].deleted?.id // 1
|
|
76
|
+
rbTree.isAVLBalanced(); // true
|
|
77
|
+
rbTree.getHeight() // 4
|
|
78
|
+
|
|
79
|
+
rbTree.delete(4, true)[0].deleted?.id // 4
|
|
80
|
+
rbTree.isAVLBalanced(); // true
|
|
81
|
+
rbTree.getHeight() // 4
|
|
82
|
+
|
|
83
|
+
rbTree.delete(10, true)[0].deleted?.id // 10
|
|
84
|
+
rbTree.isAVLBalanced(); // true
|
|
85
|
+
rbTree.getHeight() // 3
|
|
86
|
+
|
|
87
|
+
rbTree.delete(15, true)[0].deleted?.id // 15
|
|
88
|
+
rbTree.isAVLBalanced(); // true
|
|
89
|
+
rbTree.getHeight() // 3
|
|
90
|
+
|
|
91
|
+
rbTree.delete(5, true)[0].deleted?.id // 5
|
|
92
|
+
rbTree.isAVLBalanced(); // true
|
|
93
|
+
rbTree.getHeight() // 3
|
|
94
|
+
|
|
95
|
+
rbTree.delete(13, true)[0].deleted?.id // 13
|
|
96
|
+
rbTree.isAVLBalanced(); // true
|
|
97
|
+
rbTree.getHeight() // 3
|
|
98
|
+
|
|
99
|
+
rbTree.delete(3, true)[0].deleted?.id // 3
|
|
100
|
+
rbTree.isAVLBalanced(); // true
|
|
101
|
+
rbTree.getHeight() // 3
|
|
102
|
+
|
|
103
|
+
rbTree.delete(8, true)[0].deleted?.id // 8
|
|
104
|
+
rbTree.isAVLBalanced(); // true
|
|
105
|
+
rbTree.getHeight() // 3
|
|
106
|
+
|
|
107
|
+
rbTree.delete(6, true)[0].deleted?.id // 6
|
|
108
|
+
rbTree.delete(6, true).length // 0
|
|
109
|
+
rbTree.isAVLBalanced(); // true
|
|
110
|
+
rbTree.getHeight() // 2
|
|
111
|
+
|
|
112
|
+
rbTree.delete(7, true)[0].deleted?.id // 7
|
|
113
|
+
rbTree.isAVLBalanced(); // true
|
|
114
|
+
rbTree.getHeight() // 2
|
|
115
|
+
|
|
116
|
+
rbTree.delete(9, true)[0].deleted?.id // 9
|
|
117
|
+
rbTree.isAVLBalanced(); // true
|
|
118
|
+
rbTree.getHeight() // 2
|
|
119
|
+
|
|
120
|
+
rbTree.delete(14, true)[0].deleted?.id // 14
|
|
121
|
+
rbTree.isAVLBalanced(); // true
|
|
122
|
+
rbTree.getHeight() // 1
|
|
123
|
+
|
|
124
|
+
rbTree.isAVLBalanced(); // true
|
|
125
|
+
const lastBFSIds = rbTree.BFS();
|
|
126
|
+
lastBFSIds[0] // 12
|
|
127
|
+
|
|
128
|
+
const lastBFSNodes = rbTree.BFS('node');
|
|
129
|
+
lastBFSNodes[0].id // 12
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### JS
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
const {RedBlackTree} = require('data-structure-typed');
|
|
136
|
+
// /* or if you prefer */ const {RedBlackTree} = require('red-black-tree-typed');
|
|
137
|
+
|
|
138
|
+
const rbTree = new RedBlackTree();
|
|
139
|
+
|
|
140
|
+
const idsOrVals = [11, 3, 15, 1, 8, 13, 16, 2, 6, 9, 12, 14, 4, 7, 10, 5];
|
|
141
|
+
rbTree.addMany(idsOrVals, idsOrVals);
|
|
142
|
+
|
|
143
|
+
const node6 = rbTree.getNodeByKey(6);
|
|
144
|
+
node6 && rbTree.getHeight(node6) // 3
|
|
145
|
+
node6 && rbTree.getDepth(node6) // 1
|
|
146
|
+
const getNodeById = rbTree.get(10, 'id');
|
|
147
|
+
getNodeById?.id // 10
|
|
148
|
+
|
|
149
|
+
const getMinNodeByRoot = rbTree.getLeftMost();
|
|
150
|
+
getMinNodeByRoot?.id // 1
|
|
151
|
+
|
|
152
|
+
const node15 = rbTree.getNodeByKey(15);
|
|
153
|
+
const getMinNodeBySpecificNode = node15 && rbTree.getLeftMost(node15);
|
|
154
|
+
getMinNodeBySpecificNode?.id // 12
|
|
155
|
+
|
|
156
|
+
const node11 = rbTree.getNodeByKey(11);
|
|
157
|
+
node11?.id // 11
|
|
158
|
+
|
|
159
|
+
const dfs = rbTree.dfs('in');
|
|
160
|
+
dfs[0].id // 1
|
|
161
|
+
rbTree.perfectlyBalance();
|
|
162
|
+
const bfs = rbTree.bfs('node');
|
|
163
|
+
rbTree.isPerfectlyBalanced() && bfs[0].id // 8
|
|
164
|
+
|
|
165
|
+
rbTree.delete(11, true)[0].deleted?.id // 11
|
|
166
|
+
rbTree.isAVLBalanced(); // true
|
|
167
|
+
node15 && rbTree.getHeight(node15) // 2
|
|
168
|
+
rbTree.delete(1, true)[0].deleted?.id // 1
|
|
169
|
+
rbTree.isAVLBalanced(); // true
|
|
170
|
+
rbTree.getHeight() // 4
|
|
171
|
+
|
|
172
|
+
rbTree.delete(4, true)[0].deleted?.id // 4
|
|
173
|
+
rbTree.isAVLBalanced(); // true
|
|
174
|
+
rbTree.getHeight() // 4
|
|
175
|
+
|
|
176
|
+
rbTree.delete(10, true)[0].deleted?.id // 10
|
|
177
|
+
rbTree.isAVLBalanced(); // true
|
|
178
|
+
rbTree.getHeight() // 3
|
|
179
|
+
|
|
180
|
+
rbTree.delete(15, true)[0].deleted?.id // 15
|
|
181
|
+
rbTree.isAVLBalanced(); // true
|
|
182
|
+
rbTree.getHeight() // 3
|
|
183
|
+
|
|
184
|
+
rbTree.delete(5, true)[0].deleted?.id // 5
|
|
185
|
+
rbTree.isAVLBalanced(); // true
|
|
186
|
+
rbTree.getHeight() // 3
|
|
187
|
+
|
|
188
|
+
rbTree.delete(13, true)[0].deleted?.id // 13
|
|
189
|
+
rbTree.isAVLBalanced(); // true
|
|
190
|
+
rbTree.getHeight() // 3
|
|
191
|
+
|
|
192
|
+
rbTree.delete(3, true)[0].deleted?.id // 3
|
|
193
|
+
rbTree.isAVLBalanced(); // true
|
|
194
|
+
rbTree.getHeight() // 3
|
|
195
|
+
|
|
196
|
+
rbTree.delete(8, true)[0].deleted?.id // 8
|
|
197
|
+
rbTree.isAVLBalanced(); // true
|
|
198
|
+
rbTree.getHeight() // 3
|
|
199
|
+
|
|
200
|
+
rbTree.delete(6, true)[0].deleted?.id // 6
|
|
201
|
+
rbTree.delete(6, true).length // 0
|
|
202
|
+
rbTree.isAVLBalanced(); // true
|
|
203
|
+
rbTree.getHeight() // 2
|
|
204
|
+
|
|
205
|
+
rbTree.delete(7, true)[0].deleted?.id // 7
|
|
206
|
+
rbTree.isAVLBalanced(); // true
|
|
207
|
+
rbTree.getHeight() // 2
|
|
208
|
+
|
|
209
|
+
rbTree.delete(9, true)[0].deleted?.id // 9
|
|
210
|
+
rbTree.isAVLBalanced(); // true
|
|
211
|
+
rbTree.getHeight() // 2
|
|
212
|
+
|
|
213
|
+
rbTree.delete(14, true)[0].deleted?.id // 14
|
|
214
|
+
rbTree.isAVLBalanced(); // true
|
|
215
|
+
rbTree.getHeight() // 1
|
|
216
|
+
|
|
217
|
+
rbTree.isAVLBalanced(); // true
|
|
218
|
+
const lastBFSIds = rbTree.bfs();
|
|
219
|
+
lastBFSIds[0] // 12
|
|
220
|
+
|
|
221
|
+
const lastBFSNodes = rbTree.bfs('node');
|
|
222
|
+
lastBFSNodes[0].id // 12
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
[//]: # (No deletion!!! Start of Example Replace Section)
|
|
226
|
+
|
|
227
|
+
### basic Red-Black Tree with simple number keys
|
|
228
|
+
```typescript
|
|
229
|
+
// Create a simple Red-Black Tree with numeric keys
|
|
230
|
+
const tree = new RedBlackTree([5, 2, 8, 1, 9]);
|
|
231
|
+
|
|
232
|
+
tree.print();
|
|
233
|
+
// _2___
|
|
234
|
+
// / \
|
|
235
|
+
// 1 _8_
|
|
236
|
+
// / \
|
|
237
|
+
// 5 9
|
|
238
|
+
|
|
239
|
+
// Verify the tree maintains sorted order
|
|
240
|
+
console.log([...tree.keys()]); // [1, 2, 5, 8, 9];
|
|
241
|
+
|
|
242
|
+
// Check size
|
|
243
|
+
console.log(tree.size); // 5;
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Red-Black Tree with key-value pairs for lookups
|
|
247
|
+
```typescript
|
|
248
|
+
interface Employee {
|
|
249
|
+
id: number;
|
|
250
|
+
name: string;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Create tree with employee data
|
|
254
|
+
const employees = new RedBlackTree<number, Employee>([
|
|
255
|
+
[1, { id: 1, name: 'Alice' }],
|
|
256
|
+
[3, { id: 3, name: 'Charlie' }],
|
|
257
|
+
[2, { id: 2, name: 'Bob' }]
|
|
258
|
+
]);
|
|
259
|
+
|
|
260
|
+
// Retrieve employee by ID
|
|
261
|
+
const alice = employees.get(1);
|
|
262
|
+
console.log(alice?.name); // 'Alice';
|
|
263
|
+
|
|
264
|
+
// Verify sorted order by ID
|
|
265
|
+
console.log([...employees.keys()]); // [1, 2, 3];
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Red-Black Tree range search for filtering
|
|
269
|
+
```typescript
|
|
270
|
+
interface Product {
|
|
271
|
+
name: string;
|
|
272
|
+
price: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const products = new RedBlackTree<number, Product>([
|
|
276
|
+
[10, { name: 'Item A', price: 10 }],
|
|
277
|
+
[25, { name: 'Item B', price: 25 }],
|
|
278
|
+
[40, { name: 'Item C', price: 40 }],
|
|
279
|
+
[50, { name: 'Item D', price: 50 }]
|
|
280
|
+
]);
|
|
281
|
+
|
|
282
|
+
// Find products in price range [20, 45]
|
|
283
|
+
const pricesInRange = products.rangeSearch([20, 45], node => {
|
|
284
|
+
return products.get(node)?.name;
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
console.log(pricesInRange); // ['Item B', 'Item C'];
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Red-Black Tree as database index for stock market data
|
|
291
|
+
```typescript
|
|
292
|
+
interface StockPrice {
|
|
293
|
+
symbol: string;
|
|
294
|
+
volume: number;
|
|
295
|
+
timestamp: Date;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Simulate real-time stock price index
|
|
299
|
+
const priceIndex = new RedBlackTree<number, StockPrice>([
|
|
300
|
+
[142.5, { symbol: 'AAPL', volume: 1000000, timestamp: new Date() }],
|
|
301
|
+
[335.2, { symbol: 'MSFT', volume: 800000, timestamp: new Date() }],
|
|
302
|
+
[3285.04, { symbol: 'AMZN', volume: 500000, timestamp: new Date() }],
|
|
303
|
+
[267.98, { symbol: 'META', volume: 750000, timestamp: new Date() }],
|
|
304
|
+
[234.57, { symbol: 'GOOGL', volume: 900000, timestamp: new Date() }]
|
|
305
|
+
]);
|
|
306
|
+
|
|
307
|
+
// Find highest-priced stock
|
|
308
|
+
const maxPrice = priceIndex.getRightMost();
|
|
309
|
+
console.log(priceIndex.get(maxPrice)?.symbol); // 'AMZN';
|
|
310
|
+
|
|
311
|
+
// Find stocks in price range [200, 400] for portfolio balancing
|
|
312
|
+
const stocksInRange = priceIndex.rangeSearch([200, 400], node => {
|
|
313
|
+
const stock = priceIndex.get(node);
|
|
314
|
+
return {
|
|
315
|
+
symbol: stock?.symbol,
|
|
316
|
+
price: node,
|
|
317
|
+
volume: stock?.volume
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
console.log(stocksInRange.length); // 3;
|
|
322
|
+
console.log(stocksInRange.some((s: any) => s.symbol === 'GOOGL')); // true;
|
|
323
|
+
console.log(stocksInRange.some((s: any) => s.symbol === 'META')); // true;
|
|
324
|
+
console.log(stocksInRange.some((s: any) => s.symbol === 'MSFT')); // true;
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
[//]: # (No deletion!!! End of Example Replace Section)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
## API docs & Examples
|
|
332
|
+
|
|
333
|
+
[API Docs](https://data-structure-typed-docs.vercel.app)
|
|
334
|
+
|
|
335
|
+
[Live Examples](https://vivid-algorithm.vercel.app)
|
|
336
|
+
|
|
337
|
+
<a href="https://github.com/zrwusa/vivid-algorithm" target="_blank">Examples Repository</a>
|
|
338
|
+
|
|
339
|
+
## Data Structures
|
|
340
|
+
|
|
341
|
+
<table>
|
|
342
|
+
<thead>
|
|
343
|
+
<tr>
|
|
344
|
+
<th>Data Structure</th>
|
|
345
|
+
<th>Unit Test</th>
|
|
346
|
+
<th>Performance Test</th>
|
|
347
|
+
<th>API Docs</th>
|
|
348
|
+
</tr>
|
|
349
|
+
</thead>
|
|
350
|
+
<tbody>
|
|
351
|
+
|
|
352
|
+
<tr>
|
|
353
|
+
<td>Red Black Tree</td>
|
|
354
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
355
|
+
<td><img src="https://raw.githubusercontent.com/zrwusa/assets/master/images/data-structure-typed/assets/tick.svg" alt=""></td>
|
|
356
|
+
<td><a href="https://data-structure-typed-docs.vercel.app/classes/RedBlackTree.html"><span>RedBlackTree</span></a></td>
|
|
357
|
+
</tr>
|
|
358
|
+
|
|
359
|
+
</tbody>
|
|
360
|
+
</table>
|
|
361
|
+
|
|
362
|
+
## Standard library data structure comparison
|
|
363
|
+
|
|
364
|
+
<table>
|
|
365
|
+
<thead>
|
|
366
|
+
<tr>
|
|
367
|
+
<th>Data Structure Typed</th>
|
|
368
|
+
<th>C++ STL</th>
|
|
369
|
+
<th>java.util</th>
|
|
370
|
+
<th>Python collections</th>
|
|
371
|
+
</tr>
|
|
372
|
+
</thead>
|
|
373
|
+
<tbody>
|
|
374
|
+
|
|
375
|
+
<tr>
|
|
376
|
+
<td>RedBlackTree<K, V></td>
|
|
377
|
+
<td>map<K, V></td>
|
|
378
|
+
<td>TreeMap<K, V></td>
|
|
379
|
+
<td>-</td>
|
|
380
|
+
</tr>
|
|
381
|
+
|
|
382
|
+
</tbody>
|
|
383
|
+
</table>
|
|
384
|
+
|
|
385
|
+
## Benchmark
|
|
386
|
+
|
|
387
|
+
[//]: # (No deletion!!! Start of Replace Section)
|
|
388
|
+
<div class="json-to-html-collapse clearfix 0">
|
|
389
|
+
<div class='collapsible level0' ><span class='json-to-html-label'>rb-tree</span></div>
|
|
390
|
+
<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>85.85</td><td>11.65</td><td>0.00</td></tr><tr><td>100,000 add & delete randomly</td><td>211.54</td><td>4.73</td><td>0.00</td></tr><tr><td>100,000 getNode</td><td>37.92</td><td>26.37</td><td>1.65e-4</td></tr></table></div>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
[//]: # (No deletion!!! End of Replace Section)
|
|
394
|
+
|
|
395
|
+
## Built-in classic algorithms
|
|
396
|
+
|
|
397
|
+
<table>
|
|
398
|
+
<thead>
|
|
399
|
+
<tr>
|
|
400
|
+
<th>Algorithm</th>
|
|
401
|
+
<th>Function Description</th>
|
|
402
|
+
<th>Iteration Type</th>
|
|
403
|
+
</tr>
|
|
404
|
+
</thead>
|
|
405
|
+
<tbody>
|
|
406
|
+
<tr>
|
|
407
|
+
<td>Binary Tree DFS</td>
|
|
408
|
+
<td>Traverse a binary tree in a depth-first manner, starting from the root node, first visiting the left subtree,
|
|
409
|
+
and then the right subtree, using recursion.
|
|
410
|
+
</td>
|
|
411
|
+
<td>Recursion + Iteration</td>
|
|
412
|
+
</tr>
|
|
413
|
+
<tr>
|
|
414
|
+
<td>Binary Tree BFS</td>
|
|
415
|
+
<td>Traverse a binary tree in a breadth-first manner, starting from the root node, visiting nodes level by level
|
|
416
|
+
from left to right.
|
|
417
|
+
</td>
|
|
418
|
+
<td>Iteration</td>
|
|
419
|
+
</tr>
|
|
420
|
+
|
|
421
|
+
<tr>
|
|
422
|
+
<td>Binary Tree Morris</td>
|
|
423
|
+
<td>Morris traversal is an in-order traversal algorithm for binary trees with O(1) space complexity. It allows tree
|
|
424
|
+
traversal without additional stack or recursion.
|
|
425
|
+
</td>
|
|
426
|
+
<td>Iteration</td>
|
|
427
|
+
</tr>
|
|
428
|
+
|
|
429
|
+
</tbody>
|
|
430
|
+
</table>
|
|
431
|
+
|
|
432
|
+
## Software Engineering Design Standards
|
|
433
|
+
<table>
|
|
434
|
+
<tr>
|
|
435
|
+
<th>Principle</th>
|
|
436
|
+
<th>Description</th>
|
|
437
|
+
</tr>
|
|
438
|
+
<tr>
|
|
439
|
+
<td>Practicality</td>
|
|
440
|
+
<td>Follows ES6 and ESNext standards, offering unified and considerate optional parameters, and simplifies method names.</td>
|
|
441
|
+
</tr>
|
|
442
|
+
<tr>
|
|
443
|
+
<td>Extensibility</td>
|
|
444
|
+
<td>Adheres to OOP (Object-Oriented Programming) principles, allowing inheritance for all data structures.</td>
|
|
445
|
+
</tr>
|
|
446
|
+
<tr>
|
|
447
|
+
<td>Modularization</td>
|
|
448
|
+
<td>Includes data structure modularization and independent NPM packages.</td>
|
|
449
|
+
</tr>
|
|
450
|
+
<tr>
|
|
451
|
+
<td>Efficiency</td>
|
|
452
|
+
<td>All methods provide time and space complexity, comparable to native JS performance.</td>
|
|
453
|
+
</tr>
|
|
454
|
+
<tr>
|
|
455
|
+
<td>Maintainability</td>
|
|
456
|
+
<td>Follows open-source community development standards, complete documentation, continuous integration, and adheres to TDD (Test-Driven Development) patterns.</td>
|
|
457
|
+
</tr>
|
|
458
|
+
<tr>
|
|
459
|
+
<td>Testability</td>
|
|
460
|
+
<td>Automated and customized unit testing, performance testing, and integration testing.</td>
|
|
461
|
+
</tr>
|
|
462
|
+
<tr>
|
|
463
|
+
<td>Portability</td>
|
|
464
|
+
<td>Plans for porting to Java, Python, and C++, currently achieved to 80%.</td>
|
|
465
|
+
</tr>
|
|
466
|
+
<tr>
|
|
467
|
+
<td>Reusability</td>
|
|
468
|
+
<td>Fully decoupled, minimized side effects, and adheres to OOP.</td>
|
|
469
|
+
</tr>
|
|
470
|
+
<tr>
|
|
471
|
+
<td>Security</td>
|
|
472
|
+
<td>Carefully designed security for member variables and methods. Read-write separation. Data structure software does not need to consider other security aspects.</td>
|
|
473
|
+
</tr>
|
|
474
|
+
<tr>
|
|
475
|
+
<td>Scalability</td>
|
|
476
|
+
<td>Data structure software does not involve load issues.</td>
|
|
477
|
+
</tr>
|
|
478
|
+
</table>
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<coverage generated="1696760515685" clover="3.2.0">
|
|
3
|
+
<project timestamp="1696760515685" name="All files">
|
|
4
|
+
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="2"
|
|
5
|
+
coveredmethods="1" elements="3" coveredelements="2" complexity="0" loc="1" ncloc="1" packages="1" files="1"
|
|
6
|
+
classes="1"/>
|
|
7
|
+
<file name="index.ts" path="/Users/revone/projects/data-structure-typed-individuals/red-black-tree-typed/src/index.ts">
|
|
8
|
+
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="2"
|
|
9
|
+
coveredmethods="1"/>
|
|
10
|
+
<line num="8" count="2" type="stmt"/>
|
|
11
|
+
</file>
|
|
12
|
+
</project>
|
|
13
|
+
</coverage>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"/Users/revone/projects/data-structure-typed-individuals/red-black-tree-typed/src/index.ts": {
|
|
3
|
+
"path": "/Users/revone/projects/data-structure-typed-individuals/red-black-tree-typed/src/index.ts",
|
|
4
|
+
"statementMap": {
|
|
5
|
+
"0": {
|
|
6
|
+
"start": {
|
|
7
|
+
"line": 8,
|
|
8
|
+
"column": 0
|
|
9
|
+
},
|
|
10
|
+
"end": {
|
|
11
|
+
"line": 8,
|
|
12
|
+
"column": 9
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"1": {
|
|
16
|
+
"start": {
|
|
17
|
+
"line": 8,
|
|
18
|
+
"column": 9
|
|
19
|
+
},
|
|
20
|
+
"end": {
|
|
21
|
+
"line": 8,
|
|
22
|
+
"column": 22
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"2": {
|
|
26
|
+
"start": {
|
|
27
|
+
"line": 8,
|
|
28
|
+
"column": 22
|
|
29
|
+
},
|
|
30
|
+
"end": {
|
|
31
|
+
"line": 8,
|
|
32
|
+
"column": 60
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"fnMap": {
|
|
37
|
+
"0": {
|
|
38
|
+
"name": "(anonymous_0)",
|
|
39
|
+
"decl": {
|
|
40
|
+
"start": {
|
|
41
|
+
"line": 8,
|
|
42
|
+
"column": 9
|
|
43
|
+
},
|
|
44
|
+
"end": {
|
|
45
|
+
"line": 8,
|
|
46
|
+
"column": 20
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"loc": {
|
|
50
|
+
"start": {
|
|
51
|
+
"line": 8,
|
|
52
|
+
"column": 9
|
|
53
|
+
},
|
|
54
|
+
"end": {
|
|
55
|
+
"line": 8,
|
|
56
|
+
"column": 22
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"1": {
|
|
61
|
+
"name": "(anonymous_1)",
|
|
62
|
+
"decl": {
|
|
63
|
+
"start": {
|
|
64
|
+
"line": 8,
|
|
65
|
+
"column": 22
|
|
66
|
+
},
|
|
67
|
+
"end": {
|
|
68
|
+
"line": 8,
|
|
69
|
+
"column": 29
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"loc": {
|
|
73
|
+
"start": {
|
|
74
|
+
"line": 8,
|
|
75
|
+
"column": 22
|
|
76
|
+
},
|
|
77
|
+
"end": {
|
|
78
|
+
"line": 8,
|
|
79
|
+
"column": 60
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"branchMap": {},
|
|
85
|
+
"s": {
|
|
86
|
+
"0": 1,
|
|
87
|
+
"1": 1,
|
|
88
|
+
"2": 2
|
|
89
|
+
},
|
|
90
|
+
"f": {
|
|
91
|
+
"0": 0,
|
|
92
|
+
"1": 1
|
|
93
|
+
},
|
|
94
|
+
"b": {}
|
|
95
|
+
}
|
|
96
|
+
}
|