data-structure-typed 1.31.0 → 1.32.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/.gitattributes +112 -0
- package/CHANGELOG.md +1 -1
- package/CODE-OF-CONDUCT.md +80 -0
- package/COMMANDS.md +28 -0
- package/SECURITY.md +15 -0
- package/coverage/clover.xml +3393 -0
- package/coverage/coverage-final.json +67 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +386 -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 +196 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/aa-tree.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/abstract-binary-tree.ts.html +4966 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/avl-tree.ts.html +1015 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/b-tree.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/binary-indexed-tree.ts.html +313 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/binary-tree.ts.html +226 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/bst.ts.html +1714 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/index.html +296 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/index.ts.html +121 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/rb-tree.ts.html +388 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/segment-tree.ts.html +811 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/splay-tree.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/tree-multiset.ts.html +2185 -0
- package/coverage/lcov-report/src/data-structures/binary-tree/two-three-tree.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/graph/abstract-graph.ts.html +3205 -0
- package/coverage/lcov-report/src/data-structures/graph/directed-graph.ts.html +1495 -0
- package/coverage/lcov-report/src/data-structures/graph/index.html +176 -0
- package/coverage/lcov-report/src/data-structures/graph/index.ts.html +97 -0
- package/coverage/lcov-report/src/data-structures/graph/map-graph.ts.html +472 -0
- package/coverage/lcov-report/src/data-structures/graph/undirected-graph.ts.html +907 -0
- package/coverage/lcov-report/src/data-structures/hash/coordinate-map.ts.html +286 -0
- package/coverage/lcov-report/src/data-structures/hash/coordinate-set.ts.html +253 -0
- package/coverage/lcov-report/src/data-structures/hash/hash-table.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/hash/index.html +206 -0
- package/coverage/lcov-report/src/data-structures/hash/index.ts.html +103 -0
- package/coverage/lcov-report/src/data-structures/hash/pair.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/hash/tree-map.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/hash/tree-set.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/heap/heap.ts.html +721 -0
- package/coverage/lcov-report/src/data-structures/heap/index.html +161 -0
- package/coverage/lcov-report/src/data-structures/heap/index.ts.html +94 -0
- package/coverage/lcov-report/src/data-structures/heap/max-heap.ts.html +178 -0
- package/coverage/lcov-report/src/data-structures/heap/min-heap.ts.html +181 -0
- package/coverage/lcov-report/src/data-structures/index.html +116 -0
- package/coverage/lcov-report/src/data-structures/index.ts.html +118 -0
- package/coverage/lcov-report/src/data-structures/linked-list/doubly-linked-list.ts.html +1804 -0
- package/coverage/lcov-report/src/data-structures/linked-list/index.html +161 -0
- package/coverage/lcov-report/src/data-structures/linked-list/index.ts.html +94 -0
- package/coverage/lcov-report/src/data-structures/linked-list/singly-linked-list.ts.html +1588 -0
- package/coverage/lcov-report/src/data-structures/linked-list/skip-linked-list.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/matrix/index.html +176 -0
- package/coverage/lcov-report/src/data-structures/matrix/index.ts.html +97 -0
- package/coverage/lcov-report/src/data-structures/matrix/matrix.ts.html +166 -0
- package/coverage/lcov-report/src/data-structures/matrix/matrix2d.ts.html +721 -0
- package/coverage/lcov-report/src/data-structures/matrix/navigator.ts.html +448 -0
- package/coverage/lcov-report/src/data-structures/matrix/vector2d.ts.html +1033 -0
- package/coverage/lcov-report/src/data-structures/priority-queue/index.html +161 -0
- package/coverage/lcov-report/src/data-structures/priority-queue/index.ts.html +94 -0
- package/coverage/lcov-report/src/data-structures/priority-queue/max-priority-queue.ts.html +253 -0
- package/coverage/lcov-report/src/data-structures/priority-queue/min-priority-queue.ts.html +256 -0
- package/coverage/lcov-report/src/data-structures/priority-queue/priority-queue.ts.html +1162 -0
- package/coverage/lcov-report/src/data-structures/queue/deque.ts.html +976 -0
- package/coverage/lcov-report/src/data-structures/queue/index.html +146 -0
- package/coverage/lcov-report/src/data-structures/queue/index.ts.html +91 -0
- package/coverage/lcov-report/src/data-structures/queue/queue.ts.html +658 -0
- package/coverage/lcov-report/src/data-structures/stack/index.html +131 -0
- package/coverage/lcov-report/src/data-structures/stack/index.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/stack/stack.ts.html +379 -0
- package/coverage/lcov-report/src/data-structures/tree/index.html +131 -0
- package/coverage/lcov-report/src/data-structures/tree/index.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/tree/tree.ts.html +292 -0
- package/coverage/lcov-report/src/data-structures/trie/index.html +131 -0
- package/coverage/lcov-report/src/data-structures/trie/index.ts.html +88 -0
- package/coverage/lcov-report/src/data-structures/trie/trie.ts.html +760 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/index.ts.html +97 -0
- package/coverage/lcov-report/src/interfaces/index.html +116 -0
- package/coverage/lcov-report/src/interfaces/index.ts.html +130 -0
- package/coverage/lcov-report/src/types/data-structures/abstract-binary-tree.ts.html +235 -0
- package/coverage/lcov-report/src/types/data-structures/bst.ts.html +124 -0
- package/coverage/lcov-report/src/types/data-structures/directed-graph.ts.html +109 -0
- package/coverage/lcov-report/src/types/data-structures/index.html +176 -0
- package/coverage/lcov-report/src/types/data-structures/index.ts.html +130 -0
- package/coverage/lcov-report/src/types/data-structures/rb-tree.ts.html +106 -0
- package/coverage/lcov-report/src/types/index.html +116 -0
- package/coverage/lcov-report/src/types/index.ts.html +94 -0
- package/coverage/lcov-report/src/types/utils/index.html +116 -0
- package/coverage/lcov-report/src/types/utils/index.ts.html +91 -0
- package/coverage/lcov-report/src/utils/index.html +131 -0
- package/coverage/lcov-report/src/utils/index.ts.html +88 -0
- package/coverage/lcov-report/src/utils/utils.ts.html +322 -0
- package/coverage/lcov-report/test/utils/index.html +146 -0
- package/coverage/lcov-report/test/utils/index.ts.html +91 -0
- package/coverage/lcov-report/test/utils/magnitude.ts.html +148 -0
- package/coverage/lcov-report/test/utils/number.ts.html +94 -0
- package/coverage/lcov.info +6676 -0
- package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +1 -1
- package/docs/classes/AVLTree.html +205 -282
- package/docs/classes/AVLTreeNode.html +15 -15
- package/docs/classes/AaTree.html +1 -1
- package/docs/classes/AbstractBinaryTree.html +198 -275
- package/docs/classes/AbstractBinaryTreeNode.html +21 -21
- package/docs/classes/AbstractEdge.html +11 -11
- package/docs/classes/AbstractGraph.html +36 -36
- package/docs/classes/AbstractVertex.html +8 -8
- package/docs/classes/ArrayDeque.html +14 -14
- package/docs/classes/BST.html +198 -275
- package/docs/classes/BSTNode.html +15 -15
- package/docs/classes/BTree.html +1 -1
- package/docs/classes/BinaryIndexedTree.html +9 -9
- package/docs/classes/BinaryTree.html +191 -268
- package/docs/classes/BinaryTreeNode.html +15 -15
- package/docs/classes/Character.html +4 -4
- package/docs/classes/CoordinateMap.html +9 -9
- package/docs/classes/CoordinateSet.html +8 -8
- package/docs/classes/Deque.html +34 -34
- package/docs/classes/DirectedEdge.html +15 -15
- package/docs/classes/DirectedGraph.html +52 -52
- package/docs/classes/DirectedVertex.html +6 -6
- package/docs/classes/DoublyLinkedList.html +37 -37
- package/docs/classes/DoublyLinkedListNode.html +11 -11
- package/docs/classes/HashTable.html +1 -1
- package/docs/classes/Heap.html +26 -26
- package/docs/classes/HeapItem.html +8 -8
- package/docs/classes/LinkedListQueue.html +35 -35
- package/docs/classes/MapEdge.html +13 -13
- package/docs/classes/MapGraph.html +56 -56
- package/docs/classes/MapVertex.html +12 -12
- package/docs/classes/Matrix2D.html +16 -16
- package/docs/classes/MatrixNTI2D.html +4 -4
- package/docs/classes/MaxHeap.html +26 -26
- package/docs/classes/MaxPriorityQueue.html +34 -34
- package/docs/classes/MinHeap.html +26 -26
- package/docs/classes/MinPriorityQueue.html +34 -34
- package/docs/classes/Navigator.html +10 -10
- package/docs/classes/ObjectDeque.html +25 -25
- package/docs/classes/Pair.html +1 -1
- package/docs/classes/PriorityQueue.html +32 -32
- package/docs/classes/Queue.html +22 -22
- package/docs/classes/RBTree.html +198 -275
- package/docs/classes/RBTreeNode.html +18 -18
- package/docs/classes/SegmentTree.html +17 -17
- package/docs/classes/SegmentTreeNode.html +20 -20
- package/docs/classes/SinglyLinkedList.html +35 -35
- package/docs/classes/SinglyLinkedListNode.html +8 -8
- package/docs/classes/SkipLinkedList.html +1 -1
- package/docs/classes/SplayTree.html +1 -1
- package/docs/classes/Stack.html +12 -12
- package/docs/classes/TreeMap.html +1 -1
- package/docs/classes/TreeMultiset.html +219 -296
- package/docs/classes/TreeMultisetNode.html +18 -18
- package/docs/classes/TreeNode.html +13 -13
- package/docs/classes/TreeSet.html +1 -1
- package/docs/classes/Trie.html +13 -13
- package/docs/classes/TrieNode.html +11 -11
- package/docs/classes/TwoThreeTree.html +1 -1
- package/docs/classes/UndirectedEdge.html +12 -12
- package/docs/classes/UndirectedGraph.html +40 -40
- package/docs/classes/UndirectedVertex.html +6 -6
- package/docs/classes/Vector2D.html +28 -28
- package/docs/enums/CP.html +4 -4
- package/docs/enums/FamilyPosition.html +8 -8
- package/docs/enums/LoopType.html +3 -3
- package/docs/enums/RBColor.html +3 -3
- package/docs/enums/TopologicalProperty.html +4 -4
- package/docs/functions/arrayRemove.html +1 -1
- package/docs/functions/isThunk.html +1 -1
- package/docs/functions/toThunk.html +1 -1
- package/docs/functions/trampoline.html +1 -1
- package/docs/functions/trampolineAsync.html +1 -1
- package/docs/functions/uuidV4.html +1 -1
- package/docs/interfaces/IAVLTree.html +77 -77
- package/docs/interfaces/IAbstractBinaryTree.html +72 -72
- package/docs/interfaces/IAbstractBinaryTreeNode.html +14 -14
- package/docs/interfaces/IAbstractGraph.html +15 -15
- package/docs/interfaces/IBST.html +77 -77
- package/docs/interfaces/IDirectedGraph.html +23 -23
- package/docs/interfaces/IRBTree.html +77 -77
- package/docs/interfaces/IUNDirectedGraph.html +16 -16
- package/docs/types/AVLTreeNodeNested.html +1 -1
- package/docs/types/AVLTreeOptions.html +1 -1
- package/docs/types/AbstractBinaryTreeNodeNested.html +1 -1
- package/docs/types/AbstractBinaryTreeNodeProperties.html +1 -1
- package/docs/types/AbstractBinaryTreeNodeProperty.html +1 -1
- package/docs/types/AbstractBinaryTreeOptions.html +1 -1
- package/docs/types/BSTComparator.html +1 -1
- package/docs/types/BSTNodeNested.html +1 -1
- package/docs/types/BSTOptions.html +1 -1
- package/docs/types/BinaryTreeDeletedResult.html +1 -1
- package/docs/types/BinaryTreeNodeId.html +1 -1
- package/docs/types/BinaryTreeNodeNested.html +1 -1
- package/docs/types/BinaryTreeNodePropertyName.html +1 -1
- package/docs/types/BinaryTreeOptions.html +1 -1
- package/docs/types/DFSOrderPattern.html +1 -1
- package/docs/types/DijkstraResult.html +1 -1
- package/docs/types/Direction.html +1 -1
- package/docs/types/DummyAny.html +1 -1
- package/docs/types/EdgeId.html +1 -1
- package/docs/types/HeapOptions.html +1 -1
- package/docs/types/IAVLTreeNode.html +1 -1
- package/docs/types/IBSTNode.html +1 -1
- package/docs/types/IBinaryTree.html +1 -1
- package/docs/types/IBinaryTreeNode.html +1 -1
- package/docs/types/IRBTreeNode.html +1 -1
- package/docs/types/ITreeMultiset.html +1 -1
- package/docs/types/ITreeMultisetNode.html +1 -1
- package/docs/types/KeyValueObject.html +1 -1
- package/docs/types/KeyValueObjectWithId.html +1 -1
- package/docs/types/MapGraphCoordinate.html +1 -1
- package/docs/types/NavigatorParams.html +1 -1
- package/docs/types/NodeOrPropertyName.html +1 -1
- package/docs/types/NonNumberNonObjectButDefined.html +1 -1
- package/docs/types/ObjectWithNonNumberId.html +1 -1
- package/docs/types/ObjectWithNumberId.html +1 -1
- package/docs/types/ObjectWithoutId.html +1 -1
- package/docs/types/PriorityQueueComparator.html +1 -1
- package/docs/types/PriorityQueueDFSOrderPattern.html +1 -1
- package/docs/types/PriorityQueueOptions.html +1 -1
- package/docs/types/RBTreeNodeNested.html +1 -1
- package/docs/types/RBTreeOptions.html +1 -1
- package/docs/types/RestrictValById.html +1 -1
- package/docs/types/SegmentTreeNodeVal.html +1 -1
- package/docs/types/SpecifyOptional.html +1 -1
- package/docs/types/Thunk.html +1 -1
- package/docs/types/ToThunkFn.html +1 -1
- package/docs/types/TopologicalStatus.html +1 -1
- package/docs/types/TreeMultisetNodeNested.html +1 -1
- package/docs/types/TreeMultisetOptions.html +1 -1
- package/docs/types/TrlAsyncFn.html +1 -1
- package/docs/types/TrlFn.html +1 -1
- package/docs/types/Turning.html +1 -1
- package/docs/types/VertexId.html +1 -1
- package/docs/variables/THUNK_SYMBOL.html +1 -1
- package/jest.config.js +5 -3
- package/lib/data-structures/binary-tree/abstract-binary-tree.d.ts +169 -2
- package/lib/data-structures/binary-tree/abstract-binary-tree.js +31 -47
- package/package.json +26 -23
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +1 -1
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +3 -1
- package/tsconfig.json +1 -1
- package/umd/bundle.min.js.map +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias ObjectWithoutId</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Object<wbr/>Without<wbr/>Id</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type ">Omit</span><span class="tsd-signature-symbol"><</span><a href="KeyValueObject.html" class="tsd-signature-type tsd-kind-type-alias">KeyValueObject</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">"id"</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/validate-type.ts#L7">src/types/utils/validate-type.ts:7</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<h5><span class="tsd-kind-parameter">b</span>: <span class="tsd-signature-type tsd-kind-type-parameter">T</span></h5></li></ul></div>
|
|
38
38
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
|
|
39
39
|
<ul>
|
|
40
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
40
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/priority-queue.ts#L1">src/types/data-structures/priority-queue.ts:1</a></li></ul></aside></div>
|
|
41
41
|
<div class="col-sidebar">
|
|
42
42
|
<div class="page-menu">
|
|
43
43
|
<div class="tsd-navigation settings">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias PriorityQueueDFSOrderPattern</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Priority<wbr/>QueueDFSOrder<wbr/>Pattern</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"pre"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"in"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"post"</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/priority-queue.ts#L9">src/types/data-structures/priority-queue.ts:9</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<li class="tsd-parameter">
|
|
32
32
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">nodes</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">[]</span></h5></li></ul></div><aside class="tsd-sources">
|
|
33
33
|
<ul>
|
|
34
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
34
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/priority-queue.ts#L3">src/types/data-structures/priority-queue.ts:3</a></li></ul></aside></div>
|
|
35
35
|
<div class="col-sidebar">
|
|
36
36
|
<div class="page-menu">
|
|
37
37
|
<div class="tsd-navigation settings">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<li>
|
|
23
23
|
<h4><span class="tsd-kind-type-parameter">T</span></h4></li></ul></section><aside class="tsd-sources">
|
|
24
24
|
<ul>
|
|
25
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
25
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/rb-tree.ts#L6">src/types/data-structures/rb-tree.ts:6</a></li></ul></aside></div>
|
|
26
26
|
<div class="col-sidebar">
|
|
27
27
|
<div class="page-menu">
|
|
28
28
|
<div class="tsd-navigation settings">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<h4>Type declaration</h4>
|
|
21
21
|
<ul class="tsd-parameters"></ul></div><aside class="tsd-sources">
|
|
22
22
|
<ul>
|
|
23
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
23
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/rb-tree.ts#L8">src/types/data-structures/rb-tree.ts:8</a></li></ul></aside></div>
|
|
24
24
|
<div class="col-sidebar">
|
|
25
25
|
<div class="page-menu">
|
|
26
26
|
<div class="tsd-navigation settings">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias RestrictValById</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Restrict<wbr/>Val<wbr/>By<wbr/>Id</span><span class="tsd-signature-symbol">:</span> <a href="NonNumberNonObjectButDefined.html" class="tsd-signature-type tsd-kind-type-alias">NonNumberNonObjectButDefined</a><span class="tsd-signature-symbol"> | </span><a href="ObjectWithoutId.html" class="tsd-signature-type tsd-kind-type-alias">ObjectWithoutId</a><span class="tsd-signature-symbol"> | </span><a href="ObjectWithNonNumberId.html" class="tsd-signature-type tsd-kind-type-alias">ObjectWithNonNumberId</a><span class="tsd-signature-symbol"> | </span><a href="ObjectWithNumberId.html" class="tsd-signature-type tsd-kind-type-alias">ObjectWithNumberId</a></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/validate-type.ts#L19">src/types/utils/validate-type.ts:19</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias SegmentTreeNodeVal</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Segment<wbr/>Tree<wbr/>Node<wbr/>Val</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/segment-tree.ts#L1">src/types/data-structures/segment-tree.ts:1</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<li>
|
|
25
25
|
<h4><span class="tsd-kind-type-parameter">K</span><span class="tsd-signature-symbol"> extends </span><span class="tsd-signature-symbol">keyof </span><span class="tsd-signature-type tsd-kind-type-parameter">T</span></h4></li></ul></section><aside class="tsd-sources">
|
|
26
26
|
<ul>
|
|
27
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
27
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/utils.ts#L6">src/types/utils/utils.ts:6</a></li></ul></aside></div>
|
|
28
28
|
<div class="col-sidebar">
|
|
29
29
|
<div class="page-menu">
|
|
30
30
|
<div class="tsd-navigation settings">
|
package/docs/types/Thunk.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<li class="tsd-description">
|
|
26
26
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="ToThunkFn.html" class="tsd-signature-type tsd-kind-type-alias">ToThunkFn</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><br/><span> </span><span class="tsd-kind-property">__THUNK__</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">symbol</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
|
|
27
27
|
<ul>
|
|
28
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
28
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/utils.ts#L2">src/types/utils/utils.ts:2</a></li></ul></aside></div>
|
|
29
29
|
<div class="col-sidebar">
|
|
30
30
|
<div class="page-menu">
|
|
31
31
|
<div class="tsd-navigation settings">
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<li class="tsd-description">
|
|
26
26
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">ReturnType</span><span class="tsd-signature-symbol"><</span><a href="TrlFn.html" class="tsd-signature-type tsd-kind-type-alias">TrlFn</a><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></div><aside class="tsd-sources">
|
|
27
27
|
<ul>
|
|
28
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
28
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/utils.ts#L1">src/types/utils/utils.ts:1</a></li></ul></aside></div>
|
|
29
29
|
<div class="col-sidebar">
|
|
30
30
|
<div class="page-menu">
|
|
31
31
|
<div class="tsd-navigation settings">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias TopologicalStatus</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Topological<wbr/>Status</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">0</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">1</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">2</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/directed-graph.ts#L2">src/types/data-structures/directed-graph.ts:2</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<li>
|
|
23
23
|
<h4><span class="tsd-kind-type-parameter">T</span></h4></li></ul></section><aside class="tsd-sources">
|
|
24
24
|
<ul>
|
|
25
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
25
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/tree-multiset.ts#L4">src/types/data-structures/tree-multiset.ts:4</a></li></ul></aside></div>
|
|
26
26
|
<div class="col-sidebar">
|
|
27
27
|
<div class="page-menu">
|
|
28
28
|
<div class="tsd-navigation settings">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<h4>Type declaration</h4>
|
|
21
21
|
<ul class="tsd-parameters"></ul></div><aside class="tsd-sources">
|
|
22
22
|
<ul>
|
|
23
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
23
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/tree-multiset.ts#L6">src/types/data-structures/tree-multiset.ts:6</a></li></ul></aside></div>
|
|
24
24
|
<div class="col-sidebar">
|
|
25
25
|
<div class="page-menu">
|
|
26
26
|
<div class="tsd-navigation settings">
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<h5><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5></li></ul></div>
|
|
31
31
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
|
|
32
32
|
<ul>
|
|
33
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
33
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/utils.ts#L4">src/types/utils/utils.ts:4</a></li></ul></aside></div>
|
|
34
34
|
<div class="col-sidebar">
|
|
35
35
|
<div class="page-menu">
|
|
36
36
|
<div class="tsd-navigation settings">
|
package/docs/types/TrlFn.html
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<h5><code class="tsd-tag ts-flagRest">Rest</code> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5></li></ul></div>
|
|
31
31
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
|
|
32
32
|
<ul>
|
|
33
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
33
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/utils/utils.ts#L3">src/types/utils/utils.ts:3</a></li></ul></aside></div>
|
|
34
34
|
<div class="col-sidebar">
|
|
35
35
|
<div class="page-menu">
|
|
36
36
|
<div class="tsd-navigation settings">
|
package/docs/types/Turning.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias Turning</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Turning</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/><span> </span><span class="tsd-signature-symbol">[</span><span class="tsd-kind-type-parameter">key</span><span class="tsd-signature-symbol"> in </span><a href="Direction.html" class="tsd-signature-type tsd-kind-type-alias">Direction</a><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">: </span><a href="Direction.html" class="tsd-signature-type tsd-kind-type-alias">Direction</a><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/navigator.ts#L2">src/types/data-structures/navigator.ts:2</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
package/docs/types/VertexId.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Type alias VertexId</h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-type-alias">Vertex<wbr/>Id</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/types/data-structures/abstract-graph.ts#L1">src/types/data-structures/abstract-graph.ts:1</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable THUNK_SYMBOL<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature"><span class="tsd-kind-variable">THUNK_<wbr/>SYMBOL</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">typeof </span><a href="THUNK_SYMBOL.html" class="tsd-signature-type tsd-kind-variable">THUNK_SYMBOL</a><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/zrwusa/data-structure-typed/blob/6996813/src/utils/utils.ts#L35">src/utils/utils.ts:35</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-sidebar">
|
|
22
22
|
<div class="page-menu">
|
|
23
23
|
<div class="tsd-navigation settings">
|
package/jest.config.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
preset: 'ts-jest',
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
testMatch: ['<rootDir>/test/**/*.test.ts', '<rootDir>/test/**/*.test.js'],
|
|
5
|
+
collectCoverage: true,
|
|
6
|
+
coverageDirectory: 'coverage'
|
|
5
7
|
};
|
|
@@ -201,9 +201,45 @@ export declare abstract class AbstractBinaryTree<N extends AbstractBinaryTreeNod
|
|
|
201
201
|
* @returns The function `getPathToRoot` returns an array of nodes (`N[]`).
|
|
202
202
|
*/
|
|
203
203
|
getPathToRoot(node: N, isReverse?: boolean): N[];
|
|
204
|
+
/**
|
|
205
|
+
* The function `getLeftMost` returns the leftmost node in a binary tree, starting from a specified node or the root if
|
|
206
|
+
* no node is specified.
|
|
207
|
+
* generic type representing a node in a binary tree), `BinaryTreeNodeId` (a type representing the ID of a binary tree
|
|
208
|
+
* node), or `null`.
|
|
209
|
+
* @returns The function `getLeftMost` returns the leftmost node in a binary tree. If the `beginRoot` parameter is
|
|
210
|
+
* provided, it starts the traversal from that node. If `beginRoot` is not provided or is `null`, it starts the traversal
|
|
211
|
+
* from the root of the binary tree. The function returns the leftmost node found during the traversal. If no leftmost
|
|
212
|
+
* node is found (
|
|
213
|
+
*/
|
|
204
214
|
getLeftMost(): N | null;
|
|
215
|
+
/**
|
|
216
|
+
* The function `getLeftMost` returns the leftmost node in a binary tree, starting from a specified node or the root if
|
|
217
|
+
* no node is specified.
|
|
218
|
+
* @param {N | BinaryTreeNodeId | null} [node] - The `beginRoot` parameter is optional and can be of type `N` (a
|
|
219
|
+
* generic type representing a node in a binary tree), `BinaryTreeNodeId` (a type representing the ID of a binary tree
|
|
220
|
+
* node).
|
|
221
|
+
* @returns The function `getLeftMost` returns the leftmost node in a binary tree. If the `beginRoot` parameter is
|
|
222
|
+
* provided, it starts the traversal from that node. If `beginRoot` is not provided or is `null`, it starts the traversal
|
|
223
|
+
* from the root of the binary tree. The function returns the leftmost node found during the traversal. If no leftmost
|
|
224
|
+
* node is found (
|
|
225
|
+
*/
|
|
205
226
|
getLeftMost(node: N): N;
|
|
227
|
+
/**
|
|
228
|
+
* The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using tail
|
|
229
|
+
* recursion optimization.
|
|
230
|
+
* @returns The `getRightMost` function returns the rightmost node in a binary tree. It returns the
|
|
231
|
+
* rightmost node starting from the root of the binary tree.
|
|
232
|
+
*/
|
|
206
233
|
getRightMost(): N | null;
|
|
234
|
+
/**
|
|
235
|
+
* The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using tail
|
|
236
|
+
* recursion optimization.
|
|
237
|
+
* @param {N | null} [node] - The `node` parameter is an optional parameter of type `N` or `null`. It represents the
|
|
238
|
+
* starting node from which we want to find the rightmost node. If no node is provided, the function will default to
|
|
239
|
+
* using the root node of the data structure.
|
|
240
|
+
* @returns The `getRightMost` function returns the rightmost node in a binary tree. It returns the rightmost node
|
|
241
|
+
* starting from that node.
|
|
242
|
+
*/
|
|
207
243
|
getRightMost(node: N): N;
|
|
208
244
|
/**
|
|
209
245
|
* The function checks if a binary search tree is valid by traversing it either recursively or iteratively.
|
|
@@ -244,25 +280,134 @@ export declare abstract class AbstractBinaryTree<N extends AbstractBinaryTreeNod
|
|
|
244
280
|
* @returns a boolean value.
|
|
245
281
|
*/
|
|
246
282
|
subTreeAdd(subTreeRoot: N | BinaryTreeNodeId | null, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Performs a breadth-first search (BFS) on a binary tree, accumulating properties of each node based on their 'id' property.
|
|
285
|
+
* @returns An array of binary tree node IDs.
|
|
286
|
+
*/
|
|
247
287
|
BFS(): BinaryTreeNodeId[];
|
|
288
|
+
/**
|
|
289
|
+
* Performs a breadth-first search (BFS) on a binary tree, accumulating properties of each node based on the specified property name.
|
|
290
|
+
* @param {'id'} nodeOrPropertyName - The name of the property to accumulate.
|
|
291
|
+
* @returns An array of values corresponding to the specified property.
|
|
292
|
+
*/
|
|
248
293
|
BFS(nodeOrPropertyName: 'id'): BinaryTreeNodeId[];
|
|
294
|
+
/**
|
|
295
|
+
* Performs a breadth-first search (BFS) on a binary tree, accumulating the 'val' property of each node.
|
|
296
|
+
* @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
|
|
297
|
+
* @returns An array of 'val' properties from each node.
|
|
298
|
+
*/
|
|
249
299
|
BFS(nodeOrPropertyName: 'val'): N['val'][];
|
|
300
|
+
/**
|
|
301
|
+
* Performs a breadth-first search (BFS) on a binary tree, accumulating nodes themselves.
|
|
302
|
+
* @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
|
|
303
|
+
* @returns An array of binary tree nodes.
|
|
304
|
+
*/
|
|
250
305
|
BFS(nodeOrPropertyName: 'node'): N[];
|
|
306
|
+
/**
|
|
307
|
+
* Performs a depth-first search (DFS) traversal on a binary tree and accumulates properties of each node based on their 'id' property.
|
|
308
|
+
* @returns An array of binary tree node IDs.
|
|
309
|
+
*/
|
|
251
310
|
DFS(): BinaryTreeNodeId[];
|
|
311
|
+
/**
|
|
312
|
+
* Performs a depth-first search (DFS) traversal on a binary tree and accumulates properties of each node based on the specified property name.
|
|
313
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
314
|
+
* @param {string} nodeOrPropertyName - The name of the property to accumulate.
|
|
315
|
+
* @returns An array of values corresponding to the specified property.
|
|
316
|
+
*/
|
|
252
317
|
DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
|
|
318
|
+
/**
|
|
319
|
+
* Performs a depth-first search (DFS) traversal on a binary tree and accumulates the 'val' property of each node.
|
|
320
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
321
|
+
* @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
|
|
322
|
+
* @returns An array of 'val' properties from each node.
|
|
323
|
+
*/
|
|
253
324
|
DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
|
|
325
|
+
/**
|
|
326
|
+
* Performs a depth-first search (DFS) traversal on a binary tree and accumulates nodes themselves.
|
|
327
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
328
|
+
* @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
|
|
329
|
+
* @returns An array of binary tree nodes.
|
|
330
|
+
*/
|
|
254
331
|
DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
|
|
332
|
+
/**
|
|
333
|
+
* Performs an iterative depth-first search (DFS) traversal on a binary tree and accumulates properties of each node based on their 'id' property.
|
|
334
|
+
* @returns An array of binary tree node IDs.
|
|
335
|
+
*/
|
|
255
336
|
DFSIterative(): BinaryTreeNodeId[];
|
|
337
|
+
/**
|
|
338
|
+
* Performs an iterative depth-first search (DFS) traversal on a binary tree and accumulates properties of each node based on the specified property name.
|
|
339
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
340
|
+
* @param {string} nodeOrPropertyName - The name of the property to accumulate.
|
|
341
|
+
* @returns An array of values corresponding to the specified property.
|
|
342
|
+
*/
|
|
256
343
|
DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
|
|
344
|
+
/**
|
|
345
|
+
* Performs an iterative depth-first search (DFS) traversal on a binary tree and accumulates the 'val' property of each node.
|
|
346
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
347
|
+
* @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
|
|
348
|
+
* @returns An array of 'val' properties from each node.
|
|
349
|
+
*/
|
|
257
350
|
DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
|
|
351
|
+
/**
|
|
352
|
+
* Performs an iterative depth-first search (DFS) traversal on a binary tree and accumulates nodes themselves.
|
|
353
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
354
|
+
* @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
|
|
355
|
+
* @returns An array of binary tree nodes.
|
|
356
|
+
*/
|
|
258
357
|
DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
|
|
358
|
+
/**
|
|
359
|
+
* Performs a level-order traversal on a binary tree starting from the specified node and accumulates properties of each node based on their 'id' property.
|
|
360
|
+
* @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
|
|
361
|
+
* @returns An array of binary tree node IDs.
|
|
362
|
+
*/
|
|
259
363
|
levelIterative(node: N | null): BinaryTreeNodeId[];
|
|
364
|
+
/**
|
|
365
|
+
* Performs a level-order traversal on a binary tree starting from the specified node and accumulates properties of each node based on the specified property name.
|
|
366
|
+
* @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
|
|
367
|
+
* @param {string} nodeOrPropertyName - The name of the property to accumulate.
|
|
368
|
+
* @returns An array of values corresponding to the specified property.
|
|
369
|
+
*/
|
|
260
370
|
levelIterative(node: N | null, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
|
|
371
|
+
/**
|
|
372
|
+
* Performs a level-order traversal on a binary tree starting from the specified node and accumulates the 'val' property of each node.
|
|
373
|
+
* @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
|
|
374
|
+
* @param {'val'} nodeOrPropertyName - The name of the property to accumulate.
|
|
375
|
+
* @returns An array of 'val' properties from each node.
|
|
376
|
+
*/
|
|
261
377
|
levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
|
|
378
|
+
/**
|
|
379
|
+
* Performs a level-order traversal on a binary tree starting from the specified node and accumulates nodes themselves.
|
|
380
|
+
* @param {N | null} node - The starting node for the level order traversal. If null, the root node of the tree is used as the starting node.
|
|
381
|
+
* @param {'node'} nodeOrPropertyName - The name of the property to accumulate.
|
|
382
|
+
* @returns An array of binary tree nodes.
|
|
383
|
+
*/
|
|
262
384
|
levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
|
|
385
|
+
/**
|
|
386
|
+
* Collects nodes from a binary tree by a specified property and organizes them into levels.
|
|
387
|
+
* @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
|
|
388
|
+
* @returns A 2D array of AbstractBinaryTreeNodeProperty<N> objects.
|
|
389
|
+
*/
|
|
263
390
|
listLevels(node: N | null): BinaryTreeNodeId[][];
|
|
391
|
+
/**
|
|
392
|
+
* Collects nodes from a binary tree by a specified property and organizes them into levels.
|
|
393
|
+
* @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
|
|
394
|
+
* @param {'id} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
|
|
395
|
+
* @returns A 2D array of values corresponding to the specified property.
|
|
396
|
+
*/
|
|
264
397
|
listLevels(node: N | null, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[][];
|
|
398
|
+
/**
|
|
399
|
+
* Collects nodes from a binary tree by a specified property and organizes them into levels.
|
|
400
|
+
* @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
|
|
401
|
+
* @param {'val'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
|
|
402
|
+
* @returns A 2D array of 'val' properties from each node.
|
|
403
|
+
*/
|
|
265
404
|
listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
|
|
405
|
+
/**
|
|
406
|
+
* Collects nodes from a binary tree by a specified property and organizes them into levels.
|
|
407
|
+
* @param {N | null} node - The root node of the binary tree or null. If null, the function will use the root node of the current binary tree instance.
|
|
408
|
+
* @param {'node'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
|
|
409
|
+
* @returns A 2D array of binary tree nodes.
|
|
410
|
+
*/
|
|
266
411
|
listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
|
|
267
412
|
/**
|
|
268
413
|
* The function returns the predecessor of a given node in a binary tree.
|
|
@@ -270,12 +415,34 @@ export declare abstract class AbstractBinaryTree<N extends AbstractBinaryTreeNod
|
|
|
270
415
|
* @returns the predecessor of the given node in a binary tree.
|
|
271
416
|
*/
|
|
272
417
|
getPredecessor(node: N): N;
|
|
418
|
+
/**
|
|
419
|
+
* Time complexity is O(n)
|
|
420
|
+
* Space complexity of Iterative DFS equals to recursive DFS which is O(n) because of the stack
|
|
421
|
+
*/
|
|
422
|
+
/**
|
|
423
|
+
* Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm.
|
|
424
|
+
* @returns An array of binary tree node IDs.
|
|
425
|
+
*/
|
|
273
426
|
morris(): BinaryTreeNodeId[];
|
|
427
|
+
/**
|
|
428
|
+
* Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates properties of each node based on the specified property name.
|
|
429
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
430
|
+
* @param {'id'} nodeOrPropertyName - The name of the property to accumulate.
|
|
431
|
+
* @returns An array of values corresponding to the specified property.
|
|
432
|
+
*/
|
|
274
433
|
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
|
|
434
|
+
/**
|
|
435
|
+
* Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates the 'val' property of each node.
|
|
436
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
437
|
+
* @param {'val'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
|
|
438
|
+
* @returns An array of 'val' properties from each node.
|
|
439
|
+
*/
|
|
275
440
|
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
|
|
276
441
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
442
|
+
* Performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm and accumulates nodes themselves.
|
|
443
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
444
|
+
* @param {'node'} nodeOrPropertyName - The property of the BinaryTreeNode object to collect at each level.
|
|
445
|
+
* @returns An array of binary tree nodes.
|
|
279
446
|
*/
|
|
280
447
|
morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
|
|
281
448
|
/**
|
|
@@ -557,14 +557,15 @@ export class AbstractBinaryTree {
|
|
|
557
557
|
return isReverse ? result.reverse() : result;
|
|
558
558
|
}
|
|
559
559
|
/**
|
|
560
|
-
* The `getLeftMost`
|
|
560
|
+
* The function `getLeftMost` returns the leftmost node in a binary tree, starting from a specified node or the root if
|
|
561
561
|
* no node is specified.
|
|
562
562
|
* @param {N | BinaryTreeNodeId | null} [beginRoot] - The `beginRoot` parameter is optional and can be of type `N` (a
|
|
563
563
|
* generic type representing a node in a binary tree), `BinaryTreeNodeId` (a type representing the ID of a binary tree
|
|
564
564
|
* node), or `null`.
|
|
565
565
|
* @returns The function `getLeftMost` returns the leftmost node in a binary tree. If the `beginRoot` parameter is
|
|
566
|
-
* provided, it starts the traversal from that node. If `beginRoot` is not provided or is `null`, it starts the
|
|
567
|
-
*
|
|
566
|
+
* provided, it starts the traversal from that node. If `beginRoot` is not provided or is `null`, it starts the traversal
|
|
567
|
+
* from the root of the binary tree. The function returns the leftmost node found during the traversal. If no leftmost
|
|
568
|
+
* node is found (
|
|
568
569
|
*/
|
|
569
570
|
getLeftMost(beginRoot) {
|
|
570
571
|
if (typeof beginRoot === 'number')
|
|
@@ -591,14 +592,14 @@ export class AbstractBinaryTree {
|
|
|
591
592
|
}
|
|
592
593
|
}
|
|
593
594
|
/**
|
|
594
|
-
* The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using
|
|
595
|
-
*
|
|
595
|
+
* The `getRightMost` function returns the rightmost node in a binary tree, either recursively or iteratively using tail
|
|
596
|
+
* recursion optimization.
|
|
596
597
|
* @param {N | null} [node] - The `node` parameter is an optional parameter of type `N` or `null`. It represents the
|
|
597
|
-
* starting node from which we want to find the rightmost node. If no node is provided, the
|
|
598
|
-
*
|
|
599
|
-
* @returns The
|
|
600
|
-
*
|
|
601
|
-
*
|
|
598
|
+
* starting node from which we want to find the rightmost node. If no node is provided, the function will default to
|
|
599
|
+
* using the root node of the data structure.
|
|
600
|
+
* @returns The `getRightMost` function returns the rightmost node in a binary tree. If the `node` parameter is provided,
|
|
601
|
+
* it returns the rightmost node starting from that node. If the `node` parameter is not provided, it returns the
|
|
602
|
+
* rightmost node starting from the root of the binary tree.
|
|
602
603
|
*/
|
|
603
604
|
getRightMost(node) {
|
|
604
605
|
// TODO support get right most by passing id in
|
|
@@ -793,13 +794,11 @@ export class AbstractBinaryTree {
|
|
|
793
794
|
return true;
|
|
794
795
|
}
|
|
795
796
|
/**
|
|
796
|
-
* The BFS function performs a breadth-first search on a binary tree, accumulating properties of each node based on a
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
* the
|
|
802
|
-
* @returns an instance of the `AbstractBinaryTreeNodeProperties` class with generic type `N`.
|
|
797
|
+
* The BFS function performs a breadth-first search on a binary tree, accumulating properties of each node based on a specified property name.
|
|
798
|
+
* @param {NodeOrPropertyName} [nodeOrPropertyName] - An optional parameter that represents either a node or a property name.
|
|
799
|
+
* If a node is provided, the BFS algorithm will be performed starting from that node.
|
|
800
|
+
* If a property name is provided, the BFS algorithm will be performed starting from the root node, accumulating the specified property.
|
|
801
|
+
* @returns An instance of the `AbstractBinaryTreeNodeProperties` class with generic type `N`.
|
|
803
802
|
*/
|
|
804
803
|
BFS(nodeOrPropertyName) {
|
|
805
804
|
nodeOrPropertyName = nodeOrPropertyName !== null && nodeOrPropertyName !== void 0 ? nodeOrPropertyName : 'id';
|
|
@@ -820,13 +819,9 @@ export class AbstractBinaryTree {
|
|
|
820
819
|
/**
|
|
821
820
|
* The DFS function performs a depth-first search traversal on a binary tree and returns the accumulated properties of
|
|
822
821
|
* each node based on the specified pattern and property name.
|
|
823
|
-
* @param {'in' | 'pre' | 'post'} [pattern] - The
|
|
824
|
-
* binary tree.
|
|
825
|
-
* @
|
|
826
|
-
* the name of a property of the nodes in the binary tree. This property will be used to accumulate values during the
|
|
827
|
-
* depth-first search traversal. If no `nodeOrPropertyName` is provided, the default value is `'id'`.
|
|
828
|
-
* @returns an instance of the AbstractBinaryTreeNodeProperties class, which contains the accumulated properties of the
|
|
829
|
-
* binary tree nodes based on the specified pattern and node or property name.
|
|
822
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
823
|
+
* @param {NodeOrPropertyName} [nodeOrPropertyName] - The name of a property of the nodes in the binary tree. This property will be used to accumulate values during the depth-first search traversal. If no `nodeOrPropertyName` is provided, the default value is `'id'`.
|
|
824
|
+
* @returns an instance of the AbstractBinaryTreeNodeProperties class, which contains the accumulated properties of the binary tree nodes based on the specified pattern and node or property name.
|
|
830
825
|
*/
|
|
831
826
|
DFS(pattern, nodeOrPropertyName) {
|
|
832
827
|
pattern = pattern !== null && pattern !== void 0 ? pattern : 'in';
|
|
@@ -863,13 +858,9 @@ export class AbstractBinaryTree {
|
|
|
863
858
|
/**
|
|
864
859
|
* The DFSIterative function performs an iterative depth-first search traversal on a binary tree, with the option to
|
|
865
860
|
* specify the traversal pattern and the property name to accumulate results by.
|
|
866
|
-
* @param {'in' | 'pre' | 'post'} [pattern] - The
|
|
867
|
-
* binary tree
|
|
868
|
-
* @
|
|
869
|
-
* property of the nodes that you want to retrieve or perform operations on during the depth-first search traversal. By
|
|
870
|
-
* default, it is set to `'id'`, which means that the traversal will accumulate results based on the `id` property of
|
|
871
|
-
* the
|
|
872
|
-
* @returns an object of type AbstractBinaryTreeNodeProperties<N>.
|
|
861
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
862
|
+
* @param {NodeOrPropertyName} [nodeOrPropertyName] - The name of a property of the nodes in the binary tree. This property will be used to accumulate values during the depth-first search traversal. By default, it is set to `'id'`.
|
|
863
|
+
* @returns An object of type AbstractBinaryTreeNodeProperties<N>.
|
|
873
864
|
*/
|
|
874
865
|
DFSIterative(pattern, nodeOrPropertyName) {
|
|
875
866
|
pattern = pattern || 'in';
|
|
@@ -922,8 +913,8 @@ export class AbstractBinaryTree {
|
|
|
922
913
|
* @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is an optional parameter that
|
|
923
914
|
* can be either a `BinaryTreeNode` property name or the string `'id'`. If a property name is provided, the function
|
|
924
915
|
* will accumulate results based on that property. If no property name is provided, the function will default to
|
|
925
|
-
* accumulating results
|
|
926
|
-
* @returns
|
|
916
|
+
* accumulating results based on the 'id' property.
|
|
917
|
+
* @returns An object of type `AbstractBinaryTreeNodeProperties<N>`.
|
|
927
918
|
*/
|
|
928
919
|
levelIterative(node, nodeOrPropertyName) {
|
|
929
920
|
nodeOrPropertyName = nodeOrPropertyName || 'id';
|
|
@@ -948,12 +939,9 @@ export class AbstractBinaryTree {
|
|
|
948
939
|
}
|
|
949
940
|
/**
|
|
950
941
|
* The `listLevels` function collects nodes from a binary tree by a specified property and organizes them into levels.
|
|
951
|
-
* @param {N | null} node - The `node` parameter is a BinaryTreeNode object or null. It represents the
|
|
952
|
-
*
|
|
953
|
-
* @
|
|
954
|
-
* specifies the property of the `BinaryTreeNode` object to collect at each level. It can be one of the following
|
|
955
|
-
* values:
|
|
956
|
-
* @returns The function `listLevels` returns a 2D array of `AbstractBinaryTreeNodeProperty<N>` objects.
|
|
942
|
+
* @param {N | null} node - The `node` parameter is a BinaryTreeNode object or null. It represents the root node of a binary tree. If it is null, the function will use the root node of the current binary tree instance.
|
|
943
|
+
* @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is an optional parameter that specifies the property of the `BinaryTreeNode` object to collect at each level. It can be one of the following values: 'id', 'val', or 'node'. If not provided, it defaults to 'id'.
|
|
944
|
+
* @returns A 2D array of `AbstractBinaryTreeNodeProperty<N>` objects.
|
|
957
945
|
*/
|
|
958
946
|
listLevels(node, nodeOrPropertyName) {
|
|
959
947
|
nodeOrPropertyName = nodeOrPropertyName || 'id';
|
|
@@ -1025,14 +1013,10 @@ export class AbstractBinaryTree {
|
|
|
1025
1013
|
}
|
|
1026
1014
|
}
|
|
1027
1015
|
/**
|
|
1028
|
-
* The `morris` function performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris
|
|
1029
|
-
* traversal
|
|
1030
|
-
* @param {
|
|
1031
|
-
*
|
|
1032
|
-
* @param {NodeOrPropertyName} [nodeOrPropertyName] - The `nodeOrPropertyName` parameter is used to specify the
|
|
1033
|
-
* property name of the nodes that you want to retrieve. It can be any valid property name of the nodes in the binary
|
|
1034
|
-
* tree.
|
|
1035
|
-
* @returns an array of AbstractBinaryTreeNodeProperties<N> objects.
|
|
1016
|
+
* The `morris` function performs an in-order, pre-order, or post-order traversal on a binary tree using the Morris traversal algorithm.
|
|
1017
|
+
* @param {'in' | 'pre' | 'post'} [pattern] - The traversal pattern: 'in' (in-order), 'pre' (pre-order), or 'post' (post-order).
|
|
1018
|
+
* @param {NodeOrPropertyName} [nodeOrPropertyName] - The property name of the nodes to retrieve or perform operations on during the traversal. It can be any valid property name of the nodes in the binary tree. If not provided, it defaults to 'id'.
|
|
1019
|
+
* @returns An array of AbstractBinaryTreeNodeProperties<N> objects.
|
|
1036
1020
|
*/
|
|
1037
1021
|
morris(pattern, nodeOrPropertyName) {
|
|
1038
1022
|
if (this.root === null)
|