tree-multimap-typed 1.42.5
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/.dependency-cruiser.js +449 -0
- package/.eslintrc.js +65 -0
- package/.prettierignore +6 -0
- package/.prettierrc.js +16 -0
- package/LICENSE +21 -0
- package/README.md +527 -0
- package/coverage/clover.xml +14 -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 +120 -0
- package/coverage/lcov-report/index.ts.html +110 -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/data-structures/binary-tree/avl-tree.d.ts +106 -0
- package/dist/data-structures/binary-tree/avl-tree.js +349 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +149 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +269 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +322 -0
- package/dist/data-structures/binary-tree/binary-tree.js +1305 -0
- package/dist/data-structures/binary-tree/bst.d.ts +175 -0
- package/dist/data-structures/binary-tree/bst.js +546 -0
- package/dist/data-structures/binary-tree/index.d.ts +7 -0
- package/dist/data-structures/binary-tree/index.js +23 -0
- package/dist/data-structures/binary-tree/rb-tree.d.ts +93 -0
- package/dist/data-structures/binary-tree/rb-tree.js +434 -0
- package/dist/data-structures/binary-tree/segment-tree.d.ts +67 -0
- package/dist/data-structures/binary-tree/segment-tree.js +180 -0
- package/dist/data-structures/binary-tree/tree-multimap.d.ts +126 -0
- package/dist/data-structures/binary-tree/tree-multimap.js +358 -0
- package/dist/data-structures/graph/abstract-graph.d.ts +347 -0
- package/dist/data-structures/graph/abstract-graph.js +936 -0
- package/dist/data-structures/graph/directed-graph.d.ts +194 -0
- package/dist/data-structures/graph/directed-graph.js +404 -0
- package/dist/data-structures/graph/index.d.ts +4 -0
- package/dist/data-structures/graph/index.js +20 -0
- package/dist/data-structures/graph/map-graph.d.ts +73 -0
- package/dist/data-structures/graph/map-graph.js +93 -0
- package/dist/data-structures/graph/undirected-graph.d.ts +120 -0
- package/dist/data-structures/graph/undirected-graph.js +239 -0
- package/dist/data-structures/hash/coordinate-map.d.ts +44 -0
- package/dist/data-structures/hash/coordinate-map.js +62 -0
- package/dist/data-structures/hash/coordinate-set.d.ts +36 -0
- package/dist/data-structures/hash/coordinate-set.js +52 -0
- package/dist/data-structures/hash/hash-map.d.ts +50 -0
- package/dist/data-structures/hash/hash-map.js +153 -0
- package/dist/data-structures/hash/hash-table.d.ts +103 -0
- package/dist/data-structures/hash/hash-table.js +236 -0
- package/dist/data-structures/hash/index.d.ts +6 -0
- package/dist/data-structures/hash/index.js +22 -0
- package/dist/data-structures/hash/tree-map.d.ts +2 -0
- package/dist/data-structures/hash/tree-map.js +6 -0
- package/dist/data-structures/hash/tree-set.d.ts +2 -0
- package/dist/data-structures/hash/tree-set.js +6 -0
- package/dist/data-structures/heap/heap.d.ts +235 -0
- package/dist/data-structures/heap/heap.js +515 -0
- package/dist/data-structures/heap/index.d.ts +3 -0
- package/dist/data-structures/heap/index.js +19 -0
- package/dist/data-structures/heap/max-heap.d.ts +15 -0
- package/dist/data-structures/heap/max-heap.js +26 -0
- package/dist/data-structures/heap/min-heap.d.ts +15 -0
- package/dist/data-structures/heap/min-heap.js +26 -0
- package/dist/data-structures/index.d.ts +11 -0
- package/dist/data-structures/index.js +27 -0
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +253 -0
- package/dist/data-structures/linked-list/doubly-linked-list.js +569 -0
- package/dist/data-structures/linked-list/index.d.ts +3 -0
- package/dist/data-structures/linked-list/index.js +19 -0
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +232 -0
- package/dist/data-structures/linked-list/singly-linked-list.js +533 -0
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +80 -0
- package/dist/data-structures/linked-list/skip-linked-list.js +187 -0
- package/dist/data-structures/matrix/index.d.ts +4 -0
- package/dist/data-structures/matrix/index.js +20 -0
- package/dist/data-structures/matrix/matrix.d.ts +21 -0
- package/dist/data-structures/matrix/matrix.js +28 -0
- package/dist/data-structures/matrix/matrix2d.d.ts +107 -0
- package/dist/data-structures/matrix/matrix2d.js +199 -0
- package/dist/data-structures/matrix/navigator.d.ts +52 -0
- package/dist/data-structures/matrix/navigator.js +106 -0
- package/dist/data-structures/matrix/vector2d.d.ts +200 -0
- package/dist/data-structures/matrix/vector2d.js +290 -0
- package/dist/data-structures/priority-queue/index.d.ts +3 -0
- package/dist/data-structures/priority-queue/index.js +19 -0
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +26 -0
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +26 -0
- package/dist/data-structures/priority-queue/priority-queue.d.ts +15 -0
- package/dist/data-structures/priority-queue/priority-queue.js +17 -0
- package/dist/data-structures/queue/deque.d.ts +161 -0
- package/dist/data-structures/queue/deque.js +264 -0
- package/dist/data-structures/queue/index.d.ts +2 -0
- package/dist/data-structures/queue/index.js +18 -0
- package/dist/data-structures/queue/queue.d.ts +122 -0
- package/dist/data-structures/queue/queue.js +187 -0
- package/dist/data-structures/stack/index.d.ts +1 -0
- package/dist/data-structures/stack/index.js +17 -0
- package/dist/data-structures/stack/stack.d.ts +64 -0
- package/dist/data-structures/stack/stack.js +94 -0
- package/dist/data-structures/tree/index.d.ts +1 -0
- package/dist/data-structures/tree/index.js +17 -0
- package/dist/data-structures/tree/tree.d.ts +8 -0
- package/dist/data-structures/tree/tree.js +40 -0
- package/dist/data-structures/trie/index.d.ts +1 -0
- package/dist/data-structures/trie/index.js +17 -0
- package/dist/data-structures/trie/trie.d.ts +79 -0
- package/dist/data-structures/trie/trie.js +251 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +27 -0
- package/dist/interfaces/binary-tree.d.ts +7 -0
- package/dist/interfaces/binary-tree.js +2 -0
- package/dist/interfaces/doubly-linked-list.d.ts +1 -0
- package/dist/interfaces/doubly-linked-list.js +2 -0
- package/dist/interfaces/graph.d.ts +5 -0
- package/dist/interfaces/graph.js +2 -0
- package/dist/interfaces/heap.d.ts +1 -0
- package/dist/interfaces/heap.js +2 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.js +24 -0
- package/dist/interfaces/navigator.d.ts +1 -0
- package/dist/interfaces/navigator.js +2 -0
- package/dist/interfaces/priority-queue.d.ts +1 -0
- package/dist/interfaces/priority-queue.js +2 -0
- package/dist/interfaces/segment-tree.d.ts +1 -0
- package/dist/interfaces/segment-tree.js +2 -0
- package/dist/interfaces/singly-linked-list.d.ts +1 -0
- package/dist/interfaces/singly-linked-list.js +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
- package/dist/types/data-structures/binary-tree/avl-tree.js +2 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
- package/dist/types/data-structures/binary-tree/binary-tree.js +24 -0
- package/dist/types/data-structures/binary-tree/bst.d.ts +7 -0
- package/dist/types/data-structures/binary-tree/bst.js +2 -0
- package/dist/types/data-structures/binary-tree/index.d.ts +6 -0
- package/dist/types/data-structures/binary-tree/index.js +22 -0
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +8 -0
- package/dist/types/data-structures/binary-tree/rb-tree.js +8 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
- package/dist/types/data-structures/binary-tree/segment-tree.js +2 -0
- package/dist/types/data-structures/binary-tree/tree-multimap.d.ts +4 -0
- package/dist/types/data-structures/binary-tree/tree-multimap.js +2 -0
- package/dist/types/data-structures/graph/abstract-graph.d.ts +10 -0
- package/dist/types/data-structures/graph/abstract-graph.js +2 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +6 -0
- package/dist/types/data-structures/graph/directed-graph.js +9 -0
- package/dist/types/data-structures/graph/index.d.ts +3 -0
- package/dist/types/data-structures/graph/index.js +19 -0
- package/dist/types/data-structures/graph/map-graph.d.ts +1 -0
- package/dist/types/data-structures/graph/map-graph.js +2 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +1 -0
- package/dist/types/data-structures/graph/undirected-graph.js +2 -0
- package/dist/types/data-structures/hash/coordinate-map.d.ts +1 -0
- package/dist/types/data-structures/hash/coordinate-map.js +2 -0
- package/dist/types/data-structures/hash/coordinate-set.d.ts +1 -0
- package/dist/types/data-structures/hash/coordinate-set.js +2 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +1 -0
- package/dist/types/data-structures/hash/hash-map.js +2 -0
- package/dist/types/data-structures/hash/hash-table.d.ts +1 -0
- package/dist/types/data-structures/hash/hash-table.js +2 -0
- package/dist/types/data-structures/hash/index.d.ts +1 -0
- package/dist/types/data-structures/hash/index.js +2 -0
- package/dist/types/data-structures/hash/tree-map.d.ts +1 -0
- package/dist/types/data-structures/hash/tree-map.js +2 -0
- package/dist/types/data-structures/hash/tree-set.d.ts +1 -0
- package/dist/types/data-structures/hash/tree-set.js +2 -0
- package/dist/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/data-structures/heap/heap.js +2 -0
- package/dist/types/data-structures/heap/index.d.ts +1 -0
- package/dist/types/data-structures/heap/index.js +17 -0
- package/dist/types/data-structures/heap/max-heap.d.ts +1 -0
- package/dist/types/data-structures/heap/max-heap.js +2 -0
- package/dist/types/data-structures/heap/min-heap.d.ts +1 -0
- package/dist/types/data-structures/heap/min-heap.js +2 -0
- package/dist/types/data-structures/index.d.ts +11 -0
- package/dist/types/data-structures/index.js +27 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +1 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.js +2 -0
- package/dist/types/data-structures/linked-list/index.d.ts +2 -0
- package/dist/types/data-structures/linked-list/index.js +18 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +1 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.js +2 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.js +2 -0
- package/dist/types/data-structures/matrix/index.d.ts +1 -0
- package/dist/types/data-structures/matrix/index.js +17 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +1 -0
- package/dist/types/data-structures/matrix/matrix.js +2 -0
- package/dist/types/data-structures/matrix/matrix2d.d.ts +1 -0
- package/dist/types/data-structures/matrix/matrix2d.js +2 -0
- package/dist/types/data-structures/matrix/navigator.d.ts +14 -0
- package/dist/types/data-structures/matrix/navigator.js +2 -0
- package/dist/types/data-structures/matrix/vector2d.d.ts +1 -0
- package/dist/types/data-structures/matrix/vector2d.js +2 -0
- package/dist/types/data-structures/priority-queue/index.d.ts +3 -0
- package/dist/types/data-structures/priority-queue/index.js +19 -0
- package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
- package/dist/types/data-structures/priority-queue/max-priority-queue.js +2 -0
- package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
- package/dist/types/data-structures/priority-queue/min-priority-queue.js +2 -0
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/data-structures/priority-queue/priority-queue.js +2 -0
- package/dist/types/data-structures/queue/deque.d.ts +1 -0
- package/dist/types/data-structures/queue/deque.js +2 -0
- package/dist/types/data-structures/queue/index.d.ts +2 -0
- package/dist/types/data-structures/queue/index.js +18 -0
- package/dist/types/data-structures/queue/queue.d.ts +1 -0
- package/dist/types/data-structures/queue/queue.js +2 -0
- package/dist/types/data-structures/stack/index.d.ts +1 -0
- package/dist/types/data-structures/stack/index.js +17 -0
- package/dist/types/data-structures/stack/stack.d.ts +1 -0
- package/dist/types/data-structures/stack/stack.js +2 -0
- package/dist/types/data-structures/tree/index.d.ts +1 -0
- package/dist/types/data-structures/tree/index.js +17 -0
- package/dist/types/data-structures/tree/tree.d.ts +1 -0
- package/dist/types/data-structures/tree/tree.js +2 -0
- package/dist/types/data-structures/trie/index.d.ts +1 -0
- package/dist/types/data-structures/trie/index.js +17 -0
- package/dist/types/data-structures/trie/trie.d.ts +1 -0
- package/dist/types/data-structures/trie/trie.js +2 -0
- package/dist/types/helpers.d.ts +8 -0
- package/dist/types/helpers.js +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +19 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/index.js +18 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/dist/types/utils/utils.js +2 -0
- package/dist/types/utils/validate-type.d.ts +19 -0
- package/dist/types/utils/validate-type.js +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/utils.d.ts +20 -0
- package/dist/utils/utils.js +73 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +50 -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/TreeMultiset.html +2376 -0
- package/docs/classes/TreeMultisetNode.html +313 -0
- package/docs/index.html +523 -0
- package/docs/modules.html +45 -0
- package/jest.config.js +8 -0
- package/package.json +184 -0
- package/src/data-structures/binary-tree/avl-tree.ts +352 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +306 -0
- package/src/data-structures/binary-tree/binary-tree.ts +1558 -0
- package/src/data-structures/binary-tree/bst.ts +564 -0
- package/src/data-structures/binary-tree/index.ts +7 -0
- package/src/data-structures/binary-tree/rb-tree.ts +486 -0
- package/src/data-structures/binary-tree/segment-tree.ts +190 -0
- package/src/data-structures/binary-tree/tree-multimap.ts +381 -0
- package/src/data-structures/graph/abstract-graph.ts +1056 -0
- package/src/data-structures/graph/directed-graph.ts +450 -0
- package/src/data-structures/graph/index.ts +4 -0
- package/src/data-structures/graph/map-graph.ts +106 -0
- package/src/data-structures/graph/undirected-graph.ts +260 -0
- package/src/data-structures/hash/coordinate-map.ts +63 -0
- package/src/data-structures/hash/coordinate-set.ts +52 -0
- package/src/data-structures/hash/hash-map.ts +185 -0
- package/src/data-structures/hash/hash-table.ts +268 -0
- package/src/data-structures/hash/index.ts +6 -0
- package/src/data-structures/hash/tree-map.ts +1 -0
- package/src/data-structures/hash/tree-set.ts +1 -0
- package/src/data-structures/heap/heap.ts +589 -0
- package/src/data-structures/heap/index.ts +3 -0
- package/src/data-structures/heap/max-heap.ts +26 -0
- package/src/data-structures/heap/min-heap.ts +26 -0
- package/src/data-structures/index.ts +11 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +605 -0
- package/src/data-structures/linked-list/index.ts +3 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +576 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +221 -0
- package/src/data-structures/matrix/index.ts +4 -0
- package/src/data-structures/matrix/matrix.ts +27 -0
- package/src/data-structures/matrix/matrix2d.ts +211 -0
- package/src/data-structures/matrix/navigator.ts +121 -0
- package/src/data-structures/matrix/vector2d.ts +314 -0
- package/src/data-structures/priority-queue/index.ts +3 -0
- package/src/data-structures/priority-queue/max-priority-queue.ts +25 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +25 -0
- package/src/data-structures/priority-queue/priority-queue.ts +16 -0
- package/src/data-structures/queue/deque.ts +281 -0
- package/src/data-structures/queue/index.ts +2 -0
- package/src/data-structures/queue/queue.ts +209 -0
- package/src/data-structures/stack/index.ts +1 -0
- package/src/data-structures/stack/stack.ts +102 -0
- package/src/data-structures/tree/index.ts +1 -0
- package/src/data-structures/tree/tree.ts +41 -0
- package/src/data-structures/trie/index.ts +1 -0
- package/src/data-structures/trie/trie.ts +262 -0
- package/src/index.ts +11 -0
- package/src/interfaces/binary-tree.ts +10 -0
- package/src/interfaces/doubly-linked-list.ts +1 -0
- package/src/interfaces/graph.ts +7 -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/data-structures/binary-tree/avl-tree.ts +5 -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 +11 -0
- package/src/types/data-structures/binary-tree/index.ts +6 -0
- package/src/types/data-structures/binary-tree/rb-tree.ts +8 -0
- package/src/types/data-structures/binary-tree/segment-tree.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-multimap.ts +6 -0
- package/src/types/data-structures/graph/abstract-graph.ts +11 -0
- package/src/types/data-structures/graph/directed-graph.ts +8 -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/coordinate-map.ts +1 -0
- package/src/types/data-structures/hash/coordinate-set.ts +1 -0
- package/src/types/data-structures/hash/hash-map.ts +1 -0
- package/src/types/data-structures/hash/hash-table.ts +1 -0
- package/src/types/data-structures/hash/index.ts +1 -0
- package/src/types/data-structures/hash/tree-map.ts +1 -0
- package/src/types/data-structures/hash/tree-set.ts +1 -0
- package/src/types/data-structures/heap/heap.ts +1 -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 +11 -0
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -0
- package/src/types/data-structures/linked-list/index.ts +2 -0
- package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -0
- package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
- package/src/types/data-structures/matrix/index.ts +1 -0
- package/src/types/data-structures/matrix/matrix.ts +1 -0
- package/src/types/data-structures/matrix/matrix2d.ts +1 -0
- package/src/types/data-structures/matrix/navigator.ts +14 -0
- package/src/types/data-structures/matrix/vector2d.ts +1 -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 +1 -0
- package/src/types/data-structures/queue/deque.ts +1 -0
- package/src/types/data-structures/queue/index.ts +2 -0
- package/src/types/data-structures/queue/queue.ts +1 -0
- package/src/types/data-structures/stack/index.ts +1 -0
- package/src/types/data-structures/stack/stack.ts +1 -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 +1 -0
- package/src/types/helpers.ts +11 -0
- package/src/types/index.ts +3 -0
- package/src/types/utils/index.ts +2 -0
- package/src/types/utils/utils.ts +6 -0
- package/src/types/utils/validate-type.ts +35 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/utils.ts +86 -0
- package/test/index.test.ts +461 -0
- package/tsconfig.json +38 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>tree-multiset-typed</title><meta name="description" content="Documentation for tree-multiset-typed"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
|
+
<div class="tsd-toolbar-contents container">
|
|
3
|
+
<div class="table-cell" id="tsd-search" data-base=".">
|
|
4
|
+
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<div id="tsd-toolbar-links"></div></div>
|
|
7
|
+
<ul class="results">
|
|
8
|
+
<li class="state loading">Preparing search index...</li>
|
|
9
|
+
<li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">tree-multiset-typed</a></div>
|
|
10
|
+
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header>
|
|
11
|
+
<div class="container container-main">
|
|
12
|
+
<div class="col-content">
|
|
13
|
+
<div class="tsd-page-title">
|
|
14
|
+
<h2>tree-multiset-typed</h2></div>
|
|
15
|
+
<section class="tsd-panel-group tsd-index-group">
|
|
16
|
+
<section class="tsd-panel tsd-index-panel">
|
|
17
|
+
<h3 class="tsd-index-heading uppercase">Index</h3>
|
|
18
|
+
<section class="tsd-index-section">
|
|
19
|
+
<h3 class="tsd-index-heading">Classes</h3>
|
|
20
|
+
<div class="tsd-index-list"><a href="classes/TreeMultiset.html" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Tree<wbr/>Multiset</span></a>
|
|
21
|
+
<a href="classes/TreeMultisetNode.html" class="tsd-index-link tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Tree<wbr/>Multiset<wbr/>Node</span></a>
|
|
22
|
+
</div></section></section></section></div>
|
|
23
|
+
<div class="col-sidebar">
|
|
24
|
+
<div class="page-menu">
|
|
25
|
+
<div class="tsd-navigation settings">
|
|
26
|
+
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
27
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>Settings</h3></summary>
|
|
28
|
+
<div class="tsd-accordion-details">
|
|
29
|
+
<div class="tsd-filter-visibility">
|
|
30
|
+
<h4 class="uppercase">Member Visibility</h4><form>
|
|
31
|
+
<ul id="tsd-filter-options">
|
|
32
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><use href="#icon-checkbox"></use></svg><span>Protected</span></label></li>
|
|
33
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><use href="#icon-checkbox"></use></svg><span>Private</span></label></li>
|
|
34
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><use href="#icon-checkbox"></use></svg><span>Inherited</span></label></li>
|
|
35
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><use href="#icon-checkbox"></use></svg><span>External</span></label></li></ul></form></div>
|
|
36
|
+
<div class="tsd-theme-toggle">
|
|
37
|
+
<h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div>
|
|
38
|
+
<div class="site-menu">
|
|
39
|
+
<nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-1"></use></svg><span>tree-multiset-typed</span></a>
|
|
40
|
+
<ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".">
|
|
41
|
+
<li><a href="classes/TreeMultiset.html" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>TreeMultiset</a></li>
|
|
42
|
+
<li><a href="classes/TreeMultisetNode.html" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg>TreeMultisetNode</a></li></ul></nav></div></div></div>
|
|
43
|
+
<div class="tsd-generator">
|
|
44
|
+
<p>Generated using <a href="https://typedoc.org/" rel="noopener" target="_blank">TypeDoc</a></p></div>
|
|
45
|
+
<div class="overlay"></div><svg style="display: none"><g id="icon-1"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g><g id="icon-2"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g><g id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill="var(--color-text)"></path></g><g id="icon-16"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)"></path></g><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g><g id="icon-512"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-1024"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-2048"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g><g id="icon-4096"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g><g id="icon-8192"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-16384"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g><g id="icon-32768"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)"></path></g><g id="icon-65536"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-131072"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-262144"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-524288"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z" fill="var(--color-text)"></path></g><g id="icon-chevronDown"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></g><g id="icon-chevronSmall"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-text)"></path></g><g id="icon-checkbox"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></g><g id="icon-menu"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></g><g id="icon-search"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></g><g id="icon-anchor"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></g></svg></body></html>
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
preset: 'ts-jest',
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
testMatch: ['<rootDir>/test/**/*.test.ts', '<rootDir>/test/**/*.test.js'],
|
|
5
|
+
collectCoverage: true,
|
|
6
|
+
coverageReporters: ['clover', 'json', 'lcov', ['text', {skipFull: true}], "json-summary"],
|
|
7
|
+
coverageDirectory: 'coverage'
|
|
8
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-multimap-typed",
|
|
3
|
+
"version": "1.42.5",
|
|
4
|
+
"description": "Tree Multiset, AVLTree, BST, Binary Tree. Javascript & Typescript Data Structure.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rm -rf dist && npx tsc",
|
|
8
|
+
"lint": "eslint --fix \"src/**/*.{js,ts}\"",
|
|
9
|
+
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"build:docs": "typedoc --out docs ./src",
|
|
12
|
+
"deps:check": "dependency-cruiser src",
|
|
13
|
+
"build:publish": "npm run build && npm publish"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/zrwusa/data-structure-typed"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"Tree Multiset",
|
|
21
|
+
"tree multiset",
|
|
22
|
+
"treemultimap",
|
|
23
|
+
"tree-multimap",
|
|
24
|
+
"duplicate elements",
|
|
25
|
+
"duplicate",
|
|
26
|
+
"node",
|
|
27
|
+
"nodes",
|
|
28
|
+
"element",
|
|
29
|
+
"elements",
|
|
30
|
+
"count",
|
|
31
|
+
"Count",
|
|
32
|
+
"order statistics",
|
|
33
|
+
"self balancing",
|
|
34
|
+
"selfbalancing",
|
|
35
|
+
"self-balancing",
|
|
36
|
+
"Multiset operations",
|
|
37
|
+
"efficient search",
|
|
38
|
+
"frequency",
|
|
39
|
+
"ordered traversal",
|
|
40
|
+
"dynamic resizing",
|
|
41
|
+
"element uniqueness",
|
|
42
|
+
"set operations",
|
|
43
|
+
"multiset",
|
|
44
|
+
"balanced",
|
|
45
|
+
"Balanced",
|
|
46
|
+
"avl",
|
|
47
|
+
"AVL",
|
|
48
|
+
"tree",
|
|
49
|
+
"Tree",
|
|
50
|
+
"avl tree",
|
|
51
|
+
"avl-tree",
|
|
52
|
+
"avltree",
|
|
53
|
+
"AVL Tree",
|
|
54
|
+
"self-balancing",
|
|
55
|
+
"selfbalancing",
|
|
56
|
+
"selfbalance",
|
|
57
|
+
"self balance",
|
|
58
|
+
"self",
|
|
59
|
+
"auto",
|
|
60
|
+
"height",
|
|
61
|
+
"balance",
|
|
62
|
+
"balancing",
|
|
63
|
+
"balanced",
|
|
64
|
+
"constraint",
|
|
65
|
+
"factor",
|
|
66
|
+
"auto balance",
|
|
67
|
+
"Adelson",
|
|
68
|
+
"Velsky",
|
|
69
|
+
"Landis",
|
|
70
|
+
"Adelson-Velsky and Landis Tree",
|
|
71
|
+
"height-balanced",
|
|
72
|
+
"rotations",
|
|
73
|
+
"tree rotations",
|
|
74
|
+
"balancing factor",
|
|
75
|
+
"balanced binary search tree",
|
|
76
|
+
"Adelson-Velsky-Landis tree",
|
|
77
|
+
"binary",
|
|
78
|
+
"bianry tree",
|
|
79
|
+
"Binary Tree",
|
|
80
|
+
"binary-tree",
|
|
81
|
+
"javascript",
|
|
82
|
+
"java script",
|
|
83
|
+
"JavaScript",
|
|
84
|
+
"js",
|
|
85
|
+
"typescript",
|
|
86
|
+
"type script",
|
|
87
|
+
"TypeScript",
|
|
88
|
+
"ts",
|
|
89
|
+
"complete",
|
|
90
|
+
"sorted",
|
|
91
|
+
"sorting",
|
|
92
|
+
"sort",
|
|
93
|
+
"ordered",
|
|
94
|
+
"trees",
|
|
95
|
+
"complete binary tree",
|
|
96
|
+
"bst tree",
|
|
97
|
+
"balanced binary tree",
|
|
98
|
+
"balanced bst",
|
|
99
|
+
"full binary tree",
|
|
100
|
+
"full binary trees",
|
|
101
|
+
"data",
|
|
102
|
+
"structure",
|
|
103
|
+
"structures",
|
|
104
|
+
"data structure",
|
|
105
|
+
"datastructure",
|
|
106
|
+
"data-structure",
|
|
107
|
+
"data structures",
|
|
108
|
+
"datastructures",
|
|
109
|
+
"data-structures",
|
|
110
|
+
"in data structures",
|
|
111
|
+
"in data structure",
|
|
112
|
+
"DataStructure",
|
|
113
|
+
"DataStructures",
|
|
114
|
+
"traversal",
|
|
115
|
+
"inorder",
|
|
116
|
+
"preorder",
|
|
117
|
+
"postorder",
|
|
118
|
+
"pre",
|
|
119
|
+
"in",
|
|
120
|
+
"post",
|
|
121
|
+
"order",
|
|
122
|
+
"pre-order",
|
|
123
|
+
"pre order",
|
|
124
|
+
"in-order",
|
|
125
|
+
"in order",
|
|
126
|
+
"post-order",
|
|
127
|
+
"post order",
|
|
128
|
+
"dfs",
|
|
129
|
+
"DFS",
|
|
130
|
+
"bfs",
|
|
131
|
+
"BFS",
|
|
132
|
+
"recursive",
|
|
133
|
+
"iterative",
|
|
134
|
+
"leaf",
|
|
135
|
+
"root",
|
|
136
|
+
"parent",
|
|
137
|
+
"child",
|
|
138
|
+
"depth",
|
|
139
|
+
"height",
|
|
140
|
+
"Node.js",
|
|
141
|
+
"CommonJS",
|
|
142
|
+
"ES6",
|
|
143
|
+
"UMD",
|
|
144
|
+
"esmodule",
|
|
145
|
+
"java.util",
|
|
146
|
+
"c++ stl",
|
|
147
|
+
"c++ std",
|
|
148
|
+
"Python collections",
|
|
149
|
+
"System.Collections.Generic",
|
|
150
|
+
"STL",
|
|
151
|
+
"stl",
|
|
152
|
+
"util",
|
|
153
|
+
"collection",
|
|
154
|
+
"Collection",
|
|
155
|
+
"collections",
|
|
156
|
+
"Collections"
|
|
157
|
+
],
|
|
158
|
+
"author": "Tyler Zeng zrwusa@gmail.com",
|
|
159
|
+
"license": "MIT",
|
|
160
|
+
"bugs": {
|
|
161
|
+
"url": "https://github.com/zrwusa/data-structure-typed/issues"
|
|
162
|
+
},
|
|
163
|
+
"homepage": "https://data-structure-typed-docs.vercel.app",
|
|
164
|
+
"types": "dist/index.d.ts",
|
|
165
|
+
"devDependencies": {
|
|
166
|
+
"@types/jest": "^29.5.3",
|
|
167
|
+
"@types/node": "^20.4.9",
|
|
168
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
169
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
170
|
+
"eslint": "^7.32.0",
|
|
171
|
+
"eslint-config-prettier": "^8.3.0",
|
|
172
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
173
|
+
"eslint-import-resolver-typescript": "^2.5.0",
|
|
174
|
+
"eslint-plugin-import": "^2.25.4",
|
|
175
|
+
"jest": "^29.6.2",
|
|
176
|
+
"prettier": "^3.0.3",
|
|
177
|
+
"ts-jest": "^29.1.1",
|
|
178
|
+
"typedoc": "^0.25.1",
|
|
179
|
+
"typescript": "^4.9.5"
|
|
180
|
+
},
|
|
181
|
+
"dependencies": {
|
|
182
|
+
"data-structure-typed": "^1.42.5"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data-structure-typed
|
|
3
|
+
*
|
|
4
|
+
* @author Tyler Zeng
|
|
5
|
+
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
|
+
* @license MIT License
|
|
7
|
+
*/
|
|
8
|
+
import {BST, BSTNode} from './bst';
|
|
9
|
+
import type {AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BTNKey} from '../../types';
|
|
10
|
+
import {BTNCallback} from '../../types';
|
|
11
|
+
import {IBinaryTree} from '../../interfaces';
|
|
12
|
+
|
|
13
|
+
export class AVLTreeNode<V = any, N extends AVLTreeNode<V, N> = AVLTreeNodeNested<V>> extends BSTNode<V, N> {
|
|
14
|
+
height: number;
|
|
15
|
+
|
|
16
|
+
constructor(key: BTNKey, value?: V) {
|
|
17
|
+
super(key, value);
|
|
18
|
+
this.height = 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class AVLTree<V = any, N extends AVLTreeNode<V, N> = AVLTreeNode<V, AVLTreeNodeNested<V>>>
|
|
23
|
+
extends BST<V, N>
|
|
24
|
+
implements IBinaryTree<V, N>
|
|
25
|
+
{
|
|
26
|
+
/**
|
|
27
|
+
* This is a constructor function for an AVL tree data structure in TypeScript.
|
|
28
|
+
* @param {AVLTreeOptions} [options] - The `options` parameter is an optional object that can be passed to the
|
|
29
|
+
* constructor of the AVLTree class. It allows you to customize the behavior of the AVL tree by providing different
|
|
30
|
+
* options.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options?: AVLTreeOptions) {
|
|
33
|
+
super(options);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The function creates a new AVL tree node with the specified key and value.
|
|
38
|
+
* @param {BTNKey} key - The key parameter is the key value that will be associated with
|
|
39
|
+
* the new node. It is used to determine the position of the node in the binary search tree.
|
|
40
|
+
* @param [value] - The parameter `value` is an optional value that can be assigned to the node. It is of
|
|
41
|
+
* type `V`, which means it can be any value that is assignable to the `value` property of the
|
|
42
|
+
* node type `N`.
|
|
43
|
+
* @returns a new AVLTreeNode object with the specified key and value.
|
|
44
|
+
*/
|
|
45
|
+
override createNode(key: BTNKey, value?: V): N {
|
|
46
|
+
return new AVLTreeNode<V, N>(key, value) as N;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The function overrides the add method of a binary tree node and balances the tree after inserting
|
|
51
|
+
* a new node.
|
|
52
|
+
* @param {BTNKey | N | undefined} keyOrNode - The `keyOrNode` parameter can accept either a
|
|
53
|
+
* `BTNKey` or a `N` (which represents a node in the binary tree) or `null`.
|
|
54
|
+
* @param [value] - The `value` parameter is the value that you want to assign to the new node that you
|
|
55
|
+
* are adding to the binary search tree.
|
|
56
|
+
* @returns The method is returning the inserted node (`N`), `null`, or `undefined`.
|
|
57
|
+
*/
|
|
58
|
+
override add(keyOrNode: BTNKey | N | null | undefined, value?: V): N | undefined {
|
|
59
|
+
if (keyOrNode === null) return undefined;
|
|
60
|
+
const inserted = super.add(keyOrNode, value);
|
|
61
|
+
if (inserted) this._balancePath(inserted);
|
|
62
|
+
return inserted;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The function overrides the delete method of a binary tree and balances the tree after deleting a
|
|
67
|
+
* node if necessary.
|
|
68
|
+
* @param {ReturnType<C>} identifier - The `identifier` parameter is either a
|
|
69
|
+
* `BTNKey` or a generic type `N`. It represents the property of the node that we are
|
|
70
|
+
* searching for. It can be a specific key value or any other property of the node.
|
|
71
|
+
* @param callback - The `callback` parameter is a function that takes a node as input and returns a
|
|
72
|
+
* value. This value is compared with the `identifier` parameter to determine if the node should be
|
|
73
|
+
* included in the result. The `callback` parameter has a default value of
|
|
74
|
+
* `this.defaultOneParamCallback`
|
|
75
|
+
* @returns The method is returning an array of `BinaryTreeDeletedResult<N>` objects.
|
|
76
|
+
*/
|
|
77
|
+
override delete<C extends BTNCallback<N>>(
|
|
78
|
+
identifier: ReturnType<C>,
|
|
79
|
+
callback: C = this.defaultOneParamCallback as C
|
|
80
|
+
): BinaryTreeDeletedResult<N>[] {
|
|
81
|
+
if ((identifier as any) instanceof AVLTreeNode) callback = (node => node) as C;
|
|
82
|
+
const deletedResults = super.delete(identifier, callback);
|
|
83
|
+
for (const {needBalanced} of deletedResults) {
|
|
84
|
+
if (needBalanced) {
|
|
85
|
+
this._balancePath(needBalanced);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return deletedResults;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The function swaps the key, value, and height properties between two nodes in a binary tree.
|
|
93
|
+
* @param {N} srcNode - The `srcNode` parameter represents the source node that needs to be swapped
|
|
94
|
+
* with the `destNode`.
|
|
95
|
+
* @param {N} destNode - The `destNode` parameter represents the destination node where the values
|
|
96
|
+
* from the source node (`srcNode`) will be swapped to.
|
|
97
|
+
* @returns The method is returning the `destNode` after swapping its properties with the `srcNode`.
|
|
98
|
+
*/
|
|
99
|
+
protected override _swap(srcNode: N, destNode: N): N {
|
|
100
|
+
const {key, value, height} = destNode;
|
|
101
|
+
const tempNode = this.createNode(key, value);
|
|
102
|
+
|
|
103
|
+
if (tempNode) {
|
|
104
|
+
tempNode.height = height;
|
|
105
|
+
|
|
106
|
+
destNode.key = srcNode.key;
|
|
107
|
+
destNode.value = srcNode.value;
|
|
108
|
+
destNode.height = srcNode.height;
|
|
109
|
+
|
|
110
|
+
srcNode.key = tempNode.key;
|
|
111
|
+
srcNode.value = tempNode.value;
|
|
112
|
+
srcNode.height = tempNode.height;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return destNode;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The function calculates the balance factor of a node in a binary tree.
|
|
120
|
+
* @param {N} node - The parameter "node" represents a node in a binary tree data structure.
|
|
121
|
+
* @returns the balance factor of a given node. The balance factor is calculated by subtracting the
|
|
122
|
+
* height of the left subtree from the height of the right subtree.
|
|
123
|
+
*/
|
|
124
|
+
protected _balanceFactor(node: N): number {
|
|
125
|
+
if (!node.right)
|
|
126
|
+
// node has no right subtree
|
|
127
|
+
return -node.height;
|
|
128
|
+
else if (!node.left)
|
|
129
|
+
// node has no left subtree
|
|
130
|
+
return +node.height;
|
|
131
|
+
else return node.right.height - node.left.height;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The function updates the height of a node in a binary tree based on the heights of its left and
|
|
136
|
+
* right children.
|
|
137
|
+
* @param {N} node - The parameter "node" represents a node in a binary tree data structure.
|
|
138
|
+
*/
|
|
139
|
+
protected _updateHeight(node: N): void {
|
|
140
|
+
if (!node.left && !node.right) node.height = 0;
|
|
141
|
+
else if (!node.left) {
|
|
142
|
+
const rightHeight = node.right ? node.right.height : 0;
|
|
143
|
+
node.height = 1 + rightHeight;
|
|
144
|
+
} else if (!node.right) node.height = 1 + node.left.height;
|
|
145
|
+
else node.height = 1 + Math.max(node.right.height, node.left.height);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The `_balancePath` function is used to update the heights of nodes and perform rotation operations
|
|
150
|
+
* to restore balance in an AVL tree after inserting a node.
|
|
151
|
+
* @param {N} node - The `node` parameter in the `_balancePath` function represents the node in the
|
|
152
|
+
* AVL tree that needs to be balanced.
|
|
153
|
+
*/
|
|
154
|
+
protected _balancePath(node: N): void {
|
|
155
|
+
const path = this.getPathToRoot(node, false); // first O(log n) + O(log n)
|
|
156
|
+
for (let i = 0; i < path.length; i++) {
|
|
157
|
+
// second O(log n)
|
|
158
|
+
const A = path[i];
|
|
159
|
+
// Update Heights: After inserting a node, backtrack from the insertion point to the root node, updating the height of each node along the way.
|
|
160
|
+
this._updateHeight(A); // first O(1)
|
|
161
|
+
// Check Balance: Simultaneously with height updates, check if each node violates the balance property of an AVL tree.
|
|
162
|
+
// Balance Restoration: If a balance issue is discovered after inserting a node, it requires balance restoration operations. Balance restoration includes four basic cases where rotation operations need to be performed to fix the balance:
|
|
163
|
+
switch (
|
|
164
|
+
this._balanceFactor(A) // second O(1)
|
|
165
|
+
) {
|
|
166
|
+
case -2:
|
|
167
|
+
if (A && A.left) {
|
|
168
|
+
if (this._balanceFactor(A.left) <= 0) {
|
|
169
|
+
// second O(1)
|
|
170
|
+
// Left Rotation (LL Rotation): When the inserted node is in the left subtree of the left subtree, causing an imbalance.
|
|
171
|
+
this._balanceLL(A);
|
|
172
|
+
} else {
|
|
173
|
+
// Left-Right Rotation (LR Rotation): When the inserted node is in the right subtree of the left subtree, causing an imbalance.
|
|
174
|
+
this._balanceLR(A);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
case +2:
|
|
179
|
+
if (A && A.right) {
|
|
180
|
+
if (this._balanceFactor(A.right) >= 0) {
|
|
181
|
+
// Right Rotation (RR Rotation): When the inserted node is in the right subtree of the right subtree, causing an imbalance.
|
|
182
|
+
this._balanceRR(A);
|
|
183
|
+
} else {
|
|
184
|
+
// Right-Left Rotation (RL Rotation): When the inserted node is in the left subtree of the right subtree, causing an imbalance.
|
|
185
|
+
this._balanceRL(A);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// TODO So far, no sure if this is necessary that Recursive Repair: Once rotation operations are executed, it may cause imbalance issues at higher levels of the tree. Therefore, you need to recursively check and repair imbalance problems upwards until you reach the root node.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The function `_balanceLL` performs a left-left rotation to balance a binary tree.
|
|
195
|
+
* @param {N} A - A is a node in a binary tree.
|
|
196
|
+
*/
|
|
197
|
+
protected _balanceLL(A: N): void {
|
|
198
|
+
const parentOfA = A.parent;
|
|
199
|
+
const B = A.left;
|
|
200
|
+
A.parent = B;
|
|
201
|
+
if (B && B.right) {
|
|
202
|
+
B.right.parent = A;
|
|
203
|
+
}
|
|
204
|
+
if (B) B.parent = parentOfA;
|
|
205
|
+
if (A === this.root) {
|
|
206
|
+
if (B) this._setRoot(B);
|
|
207
|
+
} else {
|
|
208
|
+
if (parentOfA?.left === A) {
|
|
209
|
+
parentOfA.left = B;
|
|
210
|
+
} else {
|
|
211
|
+
if (parentOfA) parentOfA.right = B;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (B) {
|
|
216
|
+
A.left = B.right;
|
|
217
|
+
B.right = A;
|
|
218
|
+
}
|
|
219
|
+
this._updateHeight(A);
|
|
220
|
+
if (B) this._updateHeight(B);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The `_balanceLR` function performs a left-right rotation to balance a binary tree.
|
|
225
|
+
* @param {N} A - A is a node in a binary tree.
|
|
226
|
+
*/
|
|
227
|
+
protected _balanceLR(A: N): void {
|
|
228
|
+
const parentOfA = A.parent;
|
|
229
|
+
const B = A.left;
|
|
230
|
+
let C = undefined;
|
|
231
|
+
if (B) {
|
|
232
|
+
C = B.right;
|
|
233
|
+
}
|
|
234
|
+
if (A) A.parent = C;
|
|
235
|
+
if (B) B.parent = C;
|
|
236
|
+
|
|
237
|
+
if (C) {
|
|
238
|
+
if (C.left) {
|
|
239
|
+
C.left.parent = B;
|
|
240
|
+
}
|
|
241
|
+
if (C.right) {
|
|
242
|
+
C.right.parent = A;
|
|
243
|
+
}
|
|
244
|
+
C.parent = parentOfA;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (A === this.root) {
|
|
248
|
+
if (C) this._setRoot(C);
|
|
249
|
+
} else {
|
|
250
|
+
if (parentOfA) {
|
|
251
|
+
if (parentOfA.left === A) {
|
|
252
|
+
parentOfA.left = C;
|
|
253
|
+
} else {
|
|
254
|
+
parentOfA.right = C;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (C) {
|
|
260
|
+
A.left = C.right;
|
|
261
|
+
if (B) B.right = C.left;
|
|
262
|
+
C.left = B;
|
|
263
|
+
C.right = A;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this._updateHeight(A);
|
|
267
|
+
B && this._updateHeight(B);
|
|
268
|
+
C && this._updateHeight(C);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* The function `_balanceRR` performs a right-right rotation to balance a binary tree.
|
|
273
|
+
* @param {N} A - A is a node in a binary tree.
|
|
274
|
+
*/
|
|
275
|
+
protected _balanceRR(A: N): void {
|
|
276
|
+
const parentOfA = A.parent;
|
|
277
|
+
const B = A.right;
|
|
278
|
+
A.parent = B;
|
|
279
|
+
if (B) {
|
|
280
|
+
if (B.left) {
|
|
281
|
+
B.left.parent = A;
|
|
282
|
+
}
|
|
283
|
+
B.parent = parentOfA;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (A === this.root) {
|
|
287
|
+
if (B) this._setRoot(B);
|
|
288
|
+
} else {
|
|
289
|
+
if (parentOfA) {
|
|
290
|
+
if (parentOfA.left === A) {
|
|
291
|
+
parentOfA.left = B;
|
|
292
|
+
} else {
|
|
293
|
+
parentOfA.right = B;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (B) {
|
|
299
|
+
A.right = B.left;
|
|
300
|
+
B.left = A;
|
|
301
|
+
}
|
|
302
|
+
this._updateHeight(A);
|
|
303
|
+
B && this._updateHeight(B);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* The function `_balanceRL` performs a right-left rotation to balance a binary tree.
|
|
308
|
+
* @param {N} A - A is a node in a binary tree.
|
|
309
|
+
*/
|
|
310
|
+
protected _balanceRL(A: N): void {
|
|
311
|
+
const parentOfA = A.parent;
|
|
312
|
+
const B = A.right;
|
|
313
|
+
let C = undefined;
|
|
314
|
+
if (B) {
|
|
315
|
+
C = B.left;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
A.parent = C;
|
|
319
|
+
if (B) B.parent = C;
|
|
320
|
+
|
|
321
|
+
if (C) {
|
|
322
|
+
if (C.left) {
|
|
323
|
+
C.left.parent = A;
|
|
324
|
+
}
|
|
325
|
+
if (C.right) {
|
|
326
|
+
C.right.parent = B;
|
|
327
|
+
}
|
|
328
|
+
C.parent = parentOfA;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (A === this.root) {
|
|
332
|
+
if (C) this._setRoot(C);
|
|
333
|
+
} else {
|
|
334
|
+
if (parentOfA) {
|
|
335
|
+
if (parentOfA.left === A) {
|
|
336
|
+
parentOfA.left = C;
|
|
337
|
+
} else {
|
|
338
|
+
parentOfA.right = C;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (C) A.right = C.left;
|
|
344
|
+
if (B && C) B.left = C.right;
|
|
345
|
+
if (C) C.left = A;
|
|
346
|
+
if (C) C.right = B;
|
|
347
|
+
|
|
348
|
+
this._updateHeight(A);
|
|
349
|
+
B && this._updateHeight(B);
|
|
350
|
+
C && this._updateHeight(C);
|
|
351
|
+
}
|
|
352
|
+
}
|