data-structure-typed 2.5.0 → 2.5.2
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/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +12984 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/package.json +3 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +4505 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +9731 -0
- package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +347 -0
- package/CHANGELOG.md +5 -1
- package/README.md +124 -29
- package/dist/cjs/binary-tree.cjs +26282 -0
- package/dist/cjs/graph.cjs +5422 -0
- package/dist/cjs/hash.cjs +1310 -0
- package/dist/cjs/heap.cjs +1602 -0
- package/dist/cjs/index.cjs +31257 -14673
- package/dist/cjs/linked-list.cjs +4576 -0
- package/dist/cjs/matrix.cjs +1080 -0
- package/dist/cjs/priority-queue.cjs +1376 -0
- package/dist/cjs/queue.cjs +4264 -0
- package/dist/cjs/stack.cjs +907 -0
- package/dist/cjs/trie.cjs +1223 -0
- package/dist/cjs-legacy/binary-tree.cjs +26319 -0
- package/dist/cjs-legacy/graph.cjs +5420 -0
- package/dist/cjs-legacy/hash.cjs +1310 -0
- package/dist/cjs-legacy/heap.cjs +1599 -0
- package/dist/cjs-legacy/index.cjs +31268 -14679
- package/dist/cjs-legacy/linked-list.cjs +4582 -0
- package/dist/cjs-legacy/matrix.cjs +1083 -0
- package/dist/cjs-legacy/priority-queue.cjs +1374 -0
- package/dist/cjs-legacy/queue.cjs +4262 -0
- package/dist/cjs-legacy/stack.cjs +907 -0
- package/dist/cjs-legacy/trie.cjs +1222 -0
- package/dist/esm/binary-tree.mjs +26267 -0
- package/dist/esm/graph.mjs +5409 -0
- package/dist/esm/hash.mjs +1307 -0
- package/dist/esm/heap.mjs +1596 -0
- package/dist/esm/index.mjs +31254 -14674
- package/dist/esm/linked-list.mjs +4569 -0
- package/dist/esm/matrix.mjs +1076 -0
- package/dist/esm/priority-queue.mjs +1372 -0
- package/dist/esm/queue.mjs +4260 -0
- package/dist/esm/stack.mjs +905 -0
- package/dist/esm/trie.mjs +1220 -0
- package/dist/esm-legacy/binary-tree.mjs +26304 -0
- package/dist/esm-legacy/graph.mjs +5407 -0
- package/dist/esm-legacy/hash.mjs +1307 -0
- package/dist/esm-legacy/heap.mjs +1593 -0
- package/dist/esm-legacy/index.mjs +31265 -14680
- package/dist/esm-legacy/linked-list.mjs +4575 -0
- package/dist/esm-legacy/matrix.mjs +1079 -0
- package/dist/esm-legacy/priority-queue.mjs +1370 -0
- package/dist/esm-legacy/queue.mjs +4258 -0
- package/dist/esm-legacy/stack.mjs +905 -0
- package/dist/esm-legacy/trie.mjs +1219 -0
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
- package/dist/types/data-structures/base/linear-base.d.ts +3 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +288 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +336 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +618 -18
- package/dist/types/data-structures/binary-tree/bst.d.ts +676 -1
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +456 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +144 -1
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +3307 -399
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3285 -360
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2674 -325
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +3072 -287
- package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
- package/dist/types/data-structures/graph/directed-graph.d.ts +240 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +216 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +274 -10
- package/dist/types/data-structures/heap/heap.d.ts +336 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +411 -3
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +363 -3
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +434 -2
- package/dist/types/data-structures/matrix/matrix.d.ts +192 -0
- package/dist/types/data-structures/queue/deque.d.ts +364 -4
- package/dist/types/data-structures/queue/queue.d.ts +288 -0
- package/dist/types/data-structures/stack/stack.d.ts +240 -0
- package/dist/types/data-structures/trie/trie.d.ts +292 -4
- package/dist/types/interfaces/graph.d.ts +1 -1
- package/dist/types/types/common.d.ts +2 -2
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
- package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/types/types/utils/validate-type.d.ts +4 -4
- package/dist/umd/data-structure-typed.js +31196 -14608
- package/dist/umd/data-structure-typed.min.js +11 -5
- package/docs-site-docusaurus/README.md +41 -0
- package/docs-site-docusaurus/docs/api/README.md +52 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +6644 -0
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +282 -0
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +2266 -0
- package/docs-site-docusaurus/docs/api/classes/BST.md +6293 -0
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +333 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +455 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +4647 -0
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +331 -0
- package/docs-site-docusaurus/docs/api/classes/Deque.md +2767 -0
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +2999 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +2685 -0
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +221 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +253 -0
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +21 -0
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +1333 -0
- package/docs-site-docusaurus/docs/api/classes/Heap.md +1881 -0
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +800 -0
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +644 -0
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +1632 -0
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +1853 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +1108 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +156 -0
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +2824 -0
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +2929 -0
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +1026 -0
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +1866 -0
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +1883 -0
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +1879 -0
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +1882 -0
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +109 -0
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +1839 -0
- package/docs-site-docusaurus/docs/api/classes/Queue.md +2244 -0
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +6888 -0
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +372 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +2897 -0
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +169 -0
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +1229 -0
- package/docs-site-docusaurus/docs/api/classes/Stack.md +1573 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +1389 -0
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +1591 -0
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +1246 -0
- package/docs-site-docusaurus/docs/api/classes/Trie.md +1708 -0
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +199 -0
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +2979 -0
- package/docs-site-docusaurus/docs/guide/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/architecture.md +615 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +451 -0
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +597 -0
- package/docs-site-docusaurus/docs/guide/installation.md +62 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +825 -0
- package/docs-site-docusaurus/docs/guide/overview.md +645 -0
- package/docs-site-docusaurus/docs/guide/performance.md +835 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +104 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +159 -0
- package/docs-site-docusaurus/fix-mdx-generics.mjs +75 -0
- package/docs-site-docusaurus/package-lock.json +18667 -0
- package/docs-site-docusaurus/package.json +50 -0
- package/docs-site-docusaurus/prefix-class-to-methods.mjs +48 -0
- package/docs-site-docusaurus/sidebars.ts +23 -0
- package/docs-site-docusaurus/sort-protected.mjs +87 -0
- package/docs-site-docusaurus/src/css/custom.css +96 -0
- package/docs-site-docusaurus/src/pages/index.module.css +13 -0
- package/docs-site-docusaurus/src/pages/index.tsx +120 -0
- package/docs-site-docusaurus/src/pages/markdown-page.md +7 -0
- package/docs-site-docusaurus/src/theme/TOCItems/index.tsx +34 -0
- package/docs-site-docusaurus/static/.nojekyll +0 -0
- package/docs-site-docusaurus/static/img/docusaurus-social-card.jpg +0 -0
- package/docs-site-docusaurus/static/img/docusaurus.png +0 -0
- package/docs-site-docusaurus/static/img/favicon.ico +0 -0
- package/docs-site-docusaurus/static/img/favicon.png +0 -0
- package/docs-site-docusaurus/static/img/logo-180.png +0 -0
- package/docs-site-docusaurus/static/img/logo.jpg +0 -0
- package/docs-site-docusaurus/static/img/logo.png +0 -0
- package/docs-site-docusaurus/static/img/logo.svg +1 -0
- package/docs-site-docusaurus/static/img/og-image.png +0 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
- package/docs-site-docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/docs-site-docusaurus/static/robots.txt +4 -0
- package/docs-site-docusaurus/typedoc.json +23 -0
- package/llms.txt +37 -0
- package/package.json +159 -55
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/base/iterable-entry-base.ts +8 -8
- package/src/data-structures/base/linear-base.ts +3 -3
- package/src/data-structures/binary-tree/avl-tree.ts +287 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +327 -5
- package/src/data-structures/binary-tree/binary-tree.ts +581 -6
- package/src/data-structures/binary-tree/bst.ts +922 -7
- package/src/data-structures/binary-tree/red-black-tree.ts +453 -0
- package/src/data-structures/binary-tree/segment-tree.ts +139 -2
- package/src/data-structures/binary-tree/tree-map.ts +3300 -495
- package/src/data-structures/binary-tree/tree-multi-map.ts +3384 -563
- package/src/data-structures/binary-tree/tree-multi-set.ts +2757 -493
- package/src/data-structures/binary-tree/tree-set.ts +3122 -440
- package/src/data-structures/graph/abstract-graph.ts +6 -6
- package/src/data-structures/graph/directed-graph.ts +230 -0
- package/src/data-structures/graph/undirected-graph.ts +207 -0
- package/src/data-structures/hash/hash-map.ts +270 -19
- package/src/data-structures/heap/heap.ts +326 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +394 -3
- package/src/data-structures/linked-list/singly-linked-list.ts +348 -3
- package/src/data-structures/linked-list/skip-linked-list.ts +421 -7
- package/src/data-structures/matrix/matrix.ts +194 -10
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +350 -5
- package/src/data-structures/queue/queue.ts +276 -0
- package/src/data-structures/stack/stack.ts +230 -0
- package/src/data-structures/trie/trie.ts +283 -7
- package/src/interfaces/graph.ts +1 -1
- package/src/types/common.ts +2 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/utils/validate-type.ts +4 -4
- package/vercel.json +6 -0
- package/dist/leetcode/avl-tree-counter.mjs +0 -2957
- package/dist/leetcode/avl-tree-multi-map.mjs +0 -2889
- package/dist/leetcode/avl-tree.mjs +0 -2720
- package/dist/leetcode/binary-tree.mjs +0 -1594
- package/dist/leetcode/bst.mjs +0 -2398
- package/dist/leetcode/deque.mjs +0 -683
- package/dist/leetcode/directed-graph.mjs +0 -1733
- package/dist/leetcode/doubly-linked-list.mjs +0 -709
- package/dist/leetcode/hash-map.mjs +0 -493
- package/dist/leetcode/heap.mjs +0 -542
- package/dist/leetcode/max-heap.mjs +0 -375
- package/dist/leetcode/max-priority-queue.mjs +0 -383
- package/dist/leetcode/min-heap.mjs +0 -363
- package/dist/leetcode/min-priority-queue.mjs +0 -371
- package/dist/leetcode/priority-queue.mjs +0 -363
- package/dist/leetcode/queue.mjs +0 -943
- package/dist/leetcode/red-black-tree.mjs +0 -2765
- package/dist/leetcode/singly-linked-list.mjs +0 -754
- package/dist/leetcode/stack.mjs +0 -217
- package/dist/leetcode/tree-counter.mjs +0 -3039
- package/dist/leetcode/tree-multi-map.mjs +0 -2913
- package/dist/leetcode/trie.mjs +0 -413
- package/dist/leetcode/undirected-graph.mjs +0 -1650
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseTransition,
|
|
3
|
+
BaseTransitionPropsValidators,
|
|
4
|
+
Comment,
|
|
5
|
+
DeprecationTypes,
|
|
6
|
+
EffectScope,
|
|
7
|
+
ErrorCodes,
|
|
8
|
+
ErrorTypeStrings,
|
|
9
|
+
Fragment,
|
|
10
|
+
KeepAlive,
|
|
11
|
+
ReactiveEffect,
|
|
12
|
+
Static,
|
|
13
|
+
Suspense,
|
|
14
|
+
Teleport,
|
|
15
|
+
Text,
|
|
16
|
+
TrackOpTypes,
|
|
17
|
+
Transition,
|
|
18
|
+
TransitionGroup,
|
|
19
|
+
TriggerOpTypes,
|
|
20
|
+
VueElement,
|
|
21
|
+
assertNumber,
|
|
22
|
+
callWithAsyncErrorHandling,
|
|
23
|
+
callWithErrorHandling,
|
|
24
|
+
camelize,
|
|
25
|
+
capitalize,
|
|
26
|
+
cloneVNode,
|
|
27
|
+
compatUtils,
|
|
28
|
+
compile,
|
|
29
|
+
computed,
|
|
30
|
+
createApp,
|
|
31
|
+
createBaseVNode,
|
|
32
|
+
createBlock,
|
|
33
|
+
createCommentVNode,
|
|
34
|
+
createElementBlock,
|
|
35
|
+
createHydrationRenderer,
|
|
36
|
+
createPropsRestProxy,
|
|
37
|
+
createRenderer,
|
|
38
|
+
createSSRApp,
|
|
39
|
+
createSlots,
|
|
40
|
+
createStaticVNode,
|
|
41
|
+
createTextVNode,
|
|
42
|
+
createVNode,
|
|
43
|
+
customRef,
|
|
44
|
+
defineAsyncComponent,
|
|
45
|
+
defineComponent,
|
|
46
|
+
defineCustomElement,
|
|
47
|
+
defineEmits,
|
|
48
|
+
defineExpose,
|
|
49
|
+
defineModel,
|
|
50
|
+
defineOptions,
|
|
51
|
+
defineProps,
|
|
52
|
+
defineSSRCustomElement,
|
|
53
|
+
defineSlots,
|
|
54
|
+
devtools,
|
|
55
|
+
effect,
|
|
56
|
+
effectScope,
|
|
57
|
+
getCurrentInstance,
|
|
58
|
+
getCurrentScope,
|
|
59
|
+
getCurrentWatcher,
|
|
60
|
+
getTransitionRawChildren,
|
|
61
|
+
guardReactiveProps,
|
|
62
|
+
h,
|
|
63
|
+
handleError,
|
|
64
|
+
hasInjectionContext,
|
|
65
|
+
hydrate,
|
|
66
|
+
hydrateOnIdle,
|
|
67
|
+
hydrateOnInteraction,
|
|
68
|
+
hydrateOnMediaQuery,
|
|
69
|
+
hydrateOnVisible,
|
|
70
|
+
initCustomFormatter,
|
|
71
|
+
initDirectivesForSSR,
|
|
72
|
+
inject,
|
|
73
|
+
isMemoSame,
|
|
74
|
+
isProxy,
|
|
75
|
+
isReactive,
|
|
76
|
+
isReadonly,
|
|
77
|
+
isRef,
|
|
78
|
+
isRuntimeOnly,
|
|
79
|
+
isShallow,
|
|
80
|
+
isVNode,
|
|
81
|
+
markRaw,
|
|
82
|
+
mergeDefaults,
|
|
83
|
+
mergeModels,
|
|
84
|
+
mergeProps,
|
|
85
|
+
nextTick,
|
|
86
|
+
nodeOps,
|
|
87
|
+
normalizeClass,
|
|
88
|
+
normalizeProps,
|
|
89
|
+
normalizeStyle,
|
|
90
|
+
onActivated,
|
|
91
|
+
onBeforeMount,
|
|
92
|
+
onBeforeUnmount,
|
|
93
|
+
onBeforeUpdate,
|
|
94
|
+
onDeactivated,
|
|
95
|
+
onErrorCaptured,
|
|
96
|
+
onMounted,
|
|
97
|
+
onRenderTracked,
|
|
98
|
+
onRenderTriggered,
|
|
99
|
+
onScopeDispose,
|
|
100
|
+
onServerPrefetch,
|
|
101
|
+
onUnmounted,
|
|
102
|
+
onUpdated,
|
|
103
|
+
onWatcherCleanup,
|
|
104
|
+
openBlock,
|
|
105
|
+
patchProp,
|
|
106
|
+
popScopeId,
|
|
107
|
+
provide,
|
|
108
|
+
proxyRefs,
|
|
109
|
+
pushScopeId,
|
|
110
|
+
queuePostFlushCb,
|
|
111
|
+
reactive,
|
|
112
|
+
readonly,
|
|
113
|
+
ref,
|
|
114
|
+
registerRuntimeCompiler,
|
|
115
|
+
render,
|
|
116
|
+
renderList,
|
|
117
|
+
renderSlot,
|
|
118
|
+
resolveComponent,
|
|
119
|
+
resolveDirective,
|
|
120
|
+
resolveDynamicComponent,
|
|
121
|
+
resolveFilter,
|
|
122
|
+
resolveTransitionHooks,
|
|
123
|
+
setBlockTracking,
|
|
124
|
+
setDevtoolsHook,
|
|
125
|
+
setTransitionHooks,
|
|
126
|
+
shallowReactive,
|
|
127
|
+
shallowReadonly,
|
|
128
|
+
shallowRef,
|
|
129
|
+
ssrContextKey,
|
|
130
|
+
ssrUtils,
|
|
131
|
+
stop,
|
|
132
|
+
toDisplayString,
|
|
133
|
+
toHandlerKey,
|
|
134
|
+
toHandlers,
|
|
135
|
+
toRaw,
|
|
136
|
+
toRef,
|
|
137
|
+
toRefs,
|
|
138
|
+
toValue,
|
|
139
|
+
transformVNodeArgs,
|
|
140
|
+
triggerRef,
|
|
141
|
+
unref,
|
|
142
|
+
useAttrs,
|
|
143
|
+
useCssModule,
|
|
144
|
+
useCssVars,
|
|
145
|
+
useHost,
|
|
146
|
+
useId,
|
|
147
|
+
useModel,
|
|
148
|
+
useSSRContext,
|
|
149
|
+
useShadowRoot,
|
|
150
|
+
useSlots,
|
|
151
|
+
useTemplateRef,
|
|
152
|
+
useTransitionState,
|
|
153
|
+
vModelCheckbox,
|
|
154
|
+
vModelDynamic,
|
|
155
|
+
vModelRadio,
|
|
156
|
+
vModelSelect,
|
|
157
|
+
vModelText,
|
|
158
|
+
vShow,
|
|
159
|
+
version,
|
|
160
|
+
warn,
|
|
161
|
+
watch,
|
|
162
|
+
watchEffect,
|
|
163
|
+
watchPostEffect,
|
|
164
|
+
watchSyncEffect,
|
|
165
|
+
withAsyncContext,
|
|
166
|
+
withCtx,
|
|
167
|
+
withDefaults,
|
|
168
|
+
withDirectives,
|
|
169
|
+
withKeys,
|
|
170
|
+
withMemo,
|
|
171
|
+
withModifiers,
|
|
172
|
+
withScopeId
|
|
173
|
+
} from "./chunk-7OIKW5WK.js";
|
|
174
|
+
export {
|
|
175
|
+
BaseTransition,
|
|
176
|
+
BaseTransitionPropsValidators,
|
|
177
|
+
Comment,
|
|
178
|
+
DeprecationTypes,
|
|
179
|
+
EffectScope,
|
|
180
|
+
ErrorCodes,
|
|
181
|
+
ErrorTypeStrings,
|
|
182
|
+
Fragment,
|
|
183
|
+
KeepAlive,
|
|
184
|
+
ReactiveEffect,
|
|
185
|
+
Static,
|
|
186
|
+
Suspense,
|
|
187
|
+
Teleport,
|
|
188
|
+
Text,
|
|
189
|
+
TrackOpTypes,
|
|
190
|
+
Transition,
|
|
191
|
+
TransitionGroup,
|
|
192
|
+
TriggerOpTypes,
|
|
193
|
+
VueElement,
|
|
194
|
+
assertNumber,
|
|
195
|
+
callWithAsyncErrorHandling,
|
|
196
|
+
callWithErrorHandling,
|
|
197
|
+
camelize,
|
|
198
|
+
capitalize,
|
|
199
|
+
cloneVNode,
|
|
200
|
+
compatUtils,
|
|
201
|
+
compile,
|
|
202
|
+
computed,
|
|
203
|
+
createApp,
|
|
204
|
+
createBlock,
|
|
205
|
+
createCommentVNode,
|
|
206
|
+
createElementBlock,
|
|
207
|
+
createBaseVNode as createElementVNode,
|
|
208
|
+
createHydrationRenderer,
|
|
209
|
+
createPropsRestProxy,
|
|
210
|
+
createRenderer,
|
|
211
|
+
createSSRApp,
|
|
212
|
+
createSlots,
|
|
213
|
+
createStaticVNode,
|
|
214
|
+
createTextVNode,
|
|
215
|
+
createVNode,
|
|
216
|
+
customRef,
|
|
217
|
+
defineAsyncComponent,
|
|
218
|
+
defineComponent,
|
|
219
|
+
defineCustomElement,
|
|
220
|
+
defineEmits,
|
|
221
|
+
defineExpose,
|
|
222
|
+
defineModel,
|
|
223
|
+
defineOptions,
|
|
224
|
+
defineProps,
|
|
225
|
+
defineSSRCustomElement,
|
|
226
|
+
defineSlots,
|
|
227
|
+
devtools,
|
|
228
|
+
effect,
|
|
229
|
+
effectScope,
|
|
230
|
+
getCurrentInstance,
|
|
231
|
+
getCurrentScope,
|
|
232
|
+
getCurrentWatcher,
|
|
233
|
+
getTransitionRawChildren,
|
|
234
|
+
guardReactiveProps,
|
|
235
|
+
h,
|
|
236
|
+
handleError,
|
|
237
|
+
hasInjectionContext,
|
|
238
|
+
hydrate,
|
|
239
|
+
hydrateOnIdle,
|
|
240
|
+
hydrateOnInteraction,
|
|
241
|
+
hydrateOnMediaQuery,
|
|
242
|
+
hydrateOnVisible,
|
|
243
|
+
initCustomFormatter,
|
|
244
|
+
initDirectivesForSSR,
|
|
245
|
+
inject,
|
|
246
|
+
isMemoSame,
|
|
247
|
+
isProxy,
|
|
248
|
+
isReactive,
|
|
249
|
+
isReadonly,
|
|
250
|
+
isRef,
|
|
251
|
+
isRuntimeOnly,
|
|
252
|
+
isShallow,
|
|
253
|
+
isVNode,
|
|
254
|
+
markRaw,
|
|
255
|
+
mergeDefaults,
|
|
256
|
+
mergeModels,
|
|
257
|
+
mergeProps,
|
|
258
|
+
nextTick,
|
|
259
|
+
nodeOps,
|
|
260
|
+
normalizeClass,
|
|
261
|
+
normalizeProps,
|
|
262
|
+
normalizeStyle,
|
|
263
|
+
onActivated,
|
|
264
|
+
onBeforeMount,
|
|
265
|
+
onBeforeUnmount,
|
|
266
|
+
onBeforeUpdate,
|
|
267
|
+
onDeactivated,
|
|
268
|
+
onErrorCaptured,
|
|
269
|
+
onMounted,
|
|
270
|
+
onRenderTracked,
|
|
271
|
+
onRenderTriggered,
|
|
272
|
+
onScopeDispose,
|
|
273
|
+
onServerPrefetch,
|
|
274
|
+
onUnmounted,
|
|
275
|
+
onUpdated,
|
|
276
|
+
onWatcherCleanup,
|
|
277
|
+
openBlock,
|
|
278
|
+
patchProp,
|
|
279
|
+
popScopeId,
|
|
280
|
+
provide,
|
|
281
|
+
proxyRefs,
|
|
282
|
+
pushScopeId,
|
|
283
|
+
queuePostFlushCb,
|
|
284
|
+
reactive,
|
|
285
|
+
readonly,
|
|
286
|
+
ref,
|
|
287
|
+
registerRuntimeCompiler,
|
|
288
|
+
render,
|
|
289
|
+
renderList,
|
|
290
|
+
renderSlot,
|
|
291
|
+
resolveComponent,
|
|
292
|
+
resolveDirective,
|
|
293
|
+
resolveDynamicComponent,
|
|
294
|
+
resolveFilter,
|
|
295
|
+
resolveTransitionHooks,
|
|
296
|
+
setBlockTracking,
|
|
297
|
+
setDevtoolsHook,
|
|
298
|
+
setTransitionHooks,
|
|
299
|
+
shallowReactive,
|
|
300
|
+
shallowReadonly,
|
|
301
|
+
shallowRef,
|
|
302
|
+
ssrContextKey,
|
|
303
|
+
ssrUtils,
|
|
304
|
+
stop,
|
|
305
|
+
toDisplayString,
|
|
306
|
+
toHandlerKey,
|
|
307
|
+
toHandlers,
|
|
308
|
+
toRaw,
|
|
309
|
+
toRef,
|
|
310
|
+
toRefs,
|
|
311
|
+
toValue,
|
|
312
|
+
transformVNodeArgs,
|
|
313
|
+
triggerRef,
|
|
314
|
+
unref,
|
|
315
|
+
useAttrs,
|
|
316
|
+
useCssModule,
|
|
317
|
+
useCssVars,
|
|
318
|
+
useHost,
|
|
319
|
+
useId,
|
|
320
|
+
useModel,
|
|
321
|
+
useSSRContext,
|
|
322
|
+
useShadowRoot,
|
|
323
|
+
useSlots,
|
|
324
|
+
useTemplateRef,
|
|
325
|
+
useTransitionState,
|
|
326
|
+
vModelCheckbox,
|
|
327
|
+
vModelDynamic,
|
|
328
|
+
vModelRadio,
|
|
329
|
+
vModelSelect,
|
|
330
|
+
vModelText,
|
|
331
|
+
vShow,
|
|
332
|
+
version,
|
|
333
|
+
warn,
|
|
334
|
+
watch,
|
|
335
|
+
watchEffect,
|
|
336
|
+
watchPostEffect,
|
|
337
|
+
watchSyncEffect,
|
|
338
|
+
withAsyncContext,
|
|
339
|
+
withCtx,
|
|
340
|
+
withDefaults,
|
|
341
|
+
withDirectives,
|
|
342
|
+
withKeys,
|
|
343
|
+
withMemo,
|
|
344
|
+
withModifiers,
|
|
345
|
+
withScopeId
|
|
346
|
+
};
|
|
347
|
+
//# sourceMappingURL=vue.js.map
|
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,11 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
9
9
|
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
|
|
10
10
|
|
|
11
|
-
## [v2.5.
|
|
11
|
+
## [v2.5.2](https://github.com/zrwusa/data-structure-typed/compare/v2.5.1...main) (upcoming)
|
|
12
|
+
|
|
13
|
+
## [v2.5.1](https://github.com/zrwusa/data-structure-typed/compare/v2.5.0...v2.5.1) (28 March 2026)
|
|
14
|
+
|
|
15
|
+
## [v2.5.0](https://github.com/zrwusa/data-structure-typed/compare/v2.4.3...v2.5.0) (27 March 2026)
|
|
12
16
|
|
|
13
17
|
### Changes
|
|
14
18
|
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](./README_CN.md)
|
|
4
4
|
|
|
5
|
-
A
|
|
5
|
+
A production-ready TypeScript data structures library featuring **Heap, Priority Queue, Deque, Trie, Graph, Red-Black Tree, TreeMap, TreeSet, SkipList, Segment Tree**, and more — with an API that feels as intuitive as JavaScript's native `Array`. Zero dependencies. Type-safe. Supports rank queries (`getRank`), positional access (`getByRank`), and range queries (`rangeByRank`).
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
> **Looking for a TreeMap or TreeSet in JavaScript?** Need a priority queue, an ordered set, or efficient rank/range queries? Tired of repeatedly sorting arrays after every insert? This library provides all of that with a unified, Array-like API.
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|

|
|
@@ -14,7 +14,7 @@ A comprehensive TypeScript data structures library with production-ready impleme
|
|
|
14
14
|

|
|
15
15
|

|
|
16
16
|
|
|
17
|
-
**📦 [Installation](#-installation) • 🎮 [Playground](#-playground) • ⚡ [Quick Start](#-quick-start-30-seconds) • 📖 [Docs](#-documentation) • 📋 [API](
|
|
17
|
+
**📦 [Installation](#-installation) • 🎮 [Playground](#-playground) • ⚡ [Quick Start](#-quick-start-30-seconds) • 📖 [Docs](#-documentation) • 📋 [API](https://data-structure-typed-docs.vercel.app/) • 💡 [Examples](./docs/GUIDES.md) • ❓ [FAQ](#-faq)**
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -28,6 +28,7 @@ A comprehensive TypeScript data structures library with production-ready impleme
|
|
|
28
28
|
6. [Key Features](#-key-features)
|
|
29
29
|
7. [Data Structures](#-data-structures-available)
|
|
30
30
|
8. [Documentation](#-documentation)
|
|
31
|
+
9. [FAQ](#-faq)
|
|
31
32
|
|
|
32
33
|
---
|
|
33
34
|
|
|
@@ -45,12 +46,35 @@ yarn add data-structure-typed
|
|
|
45
46
|
pnpm add data-structure-typed
|
|
46
47
|
```
|
|
47
48
|
|
|
49
|
+
### Subpath Imports (Tree-Shaking Friendly)
|
|
50
|
+
|
|
51
|
+
Import only what you need — bundlers automatically tree-shake unused code:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Full bundle — everything available
|
|
55
|
+
import { RedBlackTree, Deque, HashMap } from 'data-structure-typed';
|
|
56
|
+
|
|
57
|
+
// Subpath — smaller bundle, only loads the category you need
|
|
58
|
+
import { RedBlackTree, TreeMap, AVLTree } from 'data-structure-typed/binary-tree';
|
|
59
|
+
import { Deque, Queue } from 'data-structure-typed/queue';
|
|
60
|
+
import { HashMap } from 'data-structure-typed/hash';
|
|
61
|
+
import { Heap, MinHeap } from 'data-structure-typed/heap';
|
|
62
|
+
import { Trie } from 'data-structure-typed/trie';
|
|
63
|
+
import { Stack } from 'data-structure-typed/stack';
|
|
64
|
+
import { DoublyLinkedList } from 'data-structure-typed/linked-list';
|
|
65
|
+
import { DirectedGraph } from 'data-structure-typed/graph';
|
|
66
|
+
import { Matrix } from 'data-structure-typed/matrix';
|
|
67
|
+
import { MinPriorityQueue } from 'data-structure-typed/priority-queue';
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> **Note:** With `"sideEffects": false` and modern bundlers (Vite, Webpack 5, Rollup), even the full import `from 'data-structure-typed'` will tree-shake unused structures. Subpath imports give you explicit control and faster IDE autocomplete.
|
|
71
|
+
|
|
48
72
|
### Individual Packages
|
|
49
73
|
|
|
50
|
-
|
|
74
|
+
Standalone packages are also available:
|
|
51
75
|
|
|
52
76
|
```bash
|
|
53
|
-
npm i
|
|
77
|
+
npm i avl-tree-typed bst-typed heap-typed
|
|
54
78
|
```
|
|
55
79
|
|
|
56
80
|
---
|
|
@@ -232,27 +256,50 @@ const set = new Set(tree); // Set constructor
|
|
|
232
256
|
```typescript
|
|
233
257
|
import { RedBlackTree } from 'data-structure-typed';
|
|
234
258
|
|
|
235
|
-
|
|
259
|
+
// Descending comparator — highest scores first
|
|
260
|
+
const leaderboard = new RedBlackTree<number, string>([
|
|
236
261
|
[100, 'Alice'],
|
|
237
262
|
[85, 'Bob'],
|
|
238
263
|
[92, 'Charlie']
|
|
239
|
-
]);
|
|
264
|
+
], { comparator: (a, b) => b - a });
|
|
240
265
|
|
|
241
|
-
//
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
// Output:
|
|
246
|
-
// Alice: 100
|
|
247
|
-
// Charlie: 92
|
|
248
|
-
// Bob: 85
|
|
266
|
+
// Top-2 via lazy iterator — O(k log n), no array copy
|
|
267
|
+
const iter = leaderboard.entries();
|
|
268
|
+
const { value: [topScore, topPlayer] } = iter.next();
|
|
269
|
+
console.log(`${topScore}: ${topPlayer}`); // 100: Alice
|
|
249
270
|
|
|
250
|
-
// Update score
|
|
271
|
+
// Update score — O(log n)
|
|
251
272
|
leaderboard.delete(85);
|
|
252
|
-
leaderboard.set(95, 'Bob');
|
|
273
|
+
leaderboard.set(95, 'Bob');
|
|
274
|
+
|
|
275
|
+
// Range query — players scoring 90~100, O(log n + k)
|
|
276
|
+
const scores90to100 = leaderboard.rangeSearch([90, 100]);
|
|
277
|
+
// [100, 95, 92] — automatically respects tree order
|
|
278
|
+
|
|
279
|
+
// For O(log n) top-k, rank, and pagination → see Order-Statistic Tree below
|
|
280
|
+
```
|
|
253
281
|
|
|
254
|
-
|
|
255
|
-
|
|
282
|
+
### Order-Statistic Tree (Rank Queries)
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
import { RedBlackTree } from 'data-structure-typed';
|
|
286
|
+
|
|
287
|
+
const tree = new RedBlackTree<number, string>([
|
|
288
|
+
[100, 'Alice'], [85, 'Bob'], [92, 'Charlie'],
|
|
289
|
+
[78, 'Diana'], [95, 'Eve']
|
|
290
|
+
], { comparator: (a, b) => b - a, enableOrderStatistic: true });
|
|
291
|
+
|
|
292
|
+
// select(k) — find k-th element, O(log n)
|
|
293
|
+
tree.getByRank(0); // 100 (1st in tree order)
|
|
294
|
+
tree.getByRank(2); // 92 (3rd in tree order)
|
|
295
|
+
|
|
296
|
+
// rank(key) — count elements preceding key in tree order, O(log n)
|
|
297
|
+
tree.getRank(92); // 2 (2 elements before 92 in tree order)
|
|
298
|
+
|
|
299
|
+
// rangeByRank — pagination, O(log n + k)
|
|
300
|
+
tree.rangeByRank(0, 2); // [100, 95, 92] — top 3
|
|
301
|
+
|
|
302
|
+
// Also works with TreeMap, TreeSet, TreeMultiMap, TreeMultiSet
|
|
256
303
|
```
|
|
257
304
|
|
|
258
305
|
### Task Queue (Scheduling)
|
|
@@ -299,7 +346,7 @@ queue.push(6); // Add to back: O(1)
|
|
|
299
346
|
| **BinaryIndexedTree** | Prefix sums, frequency counting | O(log n) | — |
|
|
300
347
|
| **Matrix** | 2D grid arithmetic | O(n²) add | — |
|
|
301
348
|
|
|
302
|
-
👉 [See all 20+ structures →](./docs/
|
|
349
|
+
👉 [See all 20+ structures →](./docs/OVERVIEW.md) | [Full API docs →](https://data-structure-typed-docs.vercel.app/)
|
|
303
350
|
|
|
304
351
|
---
|
|
305
352
|
|
|
@@ -310,8 +357,8 @@ queue.push(6); // Add to back: O(1)
|
|
|
310
357
|
| Your Goal | Start Here | Next Steps |
|
|
311
358
|
|---------------------------|-------------------------------------------|-----------------------------------------|
|
|
312
359
|
| **Learn concepts** | [CONCEPTS.md](./docs/CONCEPTS.md) | [GUIDES.md](./docs/GUIDES.md) |
|
|
313
|
-
| **Use in my project** | [GUIDES.md](./docs/GUIDES.md) | [
|
|
314
|
-
| **Look up API** | [
|
|
360
|
+
| **Use in my project** | [GUIDES.md](./docs/GUIDES.md) | [OVERVIEW.md](./docs/OVERVIEW.md) |
|
|
361
|
+
| **Look up API** | [API Docs](https://data-structure-typed-docs.vercel.app/) | [PERFORMANCE.md](./docs/PERFORMANCE.md) |
|
|
315
362
|
| **Performance questions** | [PERFORMANCE.md](./docs/PERFORMANCE.md) | [ARCHITECTURE.md](./docs/ARCHITECTURE.md) |
|
|
316
363
|
| **Framework integration** | [INTEGRATIONS.md](./docs/INTEGRATIONS.md) | [GUIDES.md](./docs/GUIDES.md) |
|
|
317
364
|
| **Understand design** | [ARCHITECTURE.md](./docs/ARCHITECTURE.md) | [CONCEPTS.md](./docs/CONCEPTS.md) |
|
|
@@ -325,14 +372,19 @@ queue.push(6); // Add to back: O(1)
|
|
|
325
372
|
- 5 Comparisons with Native JavaScript
|
|
326
373
|
- Complete Decision Guide
|
|
327
374
|
|
|
328
|
-
2. **[
|
|
375
|
+
2. **[API Docs](https://data-structure-typed-docs.vercel.app/)** - Full API Reference (TypeDoc)
|
|
376
|
+
- Complete method signatures, parameters, return types
|
|
377
|
+
- Real-world `@example` code for every method
|
|
378
|
+
- Inheritance hierarchy and type details
|
|
379
|
+
|
|
380
|
+
3. **[OVERVIEW.md](./docs/OVERVIEW.md)** - Data Structures Overview
|
|
329
381
|
- Quick Reference Table
|
|
330
382
|
- All 20+ Structures with Examples
|
|
331
383
|
- CRUD Operations
|
|
332
384
|
- Common Methods
|
|
333
385
|
- TypeScript Support
|
|
334
386
|
|
|
335
|
-
|
|
387
|
+
4. **[ARCHITECTURE.md](./docs/ARCHITECTURE.md)** - Design & Implementation
|
|
336
388
|
- Design Philosophy & Principles
|
|
337
389
|
- 3 Pain Points Solved
|
|
338
390
|
- Why Deque is 484x Faster
|
|
@@ -340,20 +392,20 @@ queue.push(6); // Add to back: O(1)
|
|
|
340
392
|
- Self-Balancing Strategy
|
|
341
393
|
- V8 JIT Optimizations
|
|
342
394
|
|
|
343
|
-
|
|
395
|
+
5. **[PERFORMANCE.md](./docs/PERFORMANCE.md)** - Benchmarks & Comparisons
|
|
344
396
|
- Performance Summary
|
|
345
397
|
- 3 Real-World Scenarios
|
|
346
398
|
- Detailed Benchmarks
|
|
347
399
|
- When to Use What
|
|
348
400
|
- Optimization Tips
|
|
349
401
|
|
|
350
|
-
|
|
402
|
+
6. **[GUIDES.md](./docs/GUIDES.md)** - Real-World Examples
|
|
351
403
|
- 4 Design Patterns
|
|
352
404
|
- 5 Production Code Examples
|
|
353
405
|
- Common Mistakes
|
|
354
406
|
- Best Practices
|
|
355
407
|
|
|
356
|
-
|
|
408
|
+
7. **[INTEGRATIONS.md](./docs/INTEGRATIONS.md)** - Framework Integration
|
|
357
409
|
- React Integration (State Management, Leaderboard)
|
|
358
410
|
- Express Integration (LRU Cache, Rate Limiting)
|
|
359
411
|
- Nest.js Integration (Ranking Service, Task Queue)
|
|
@@ -583,7 +635,7 @@ MIT
|
|
|
583
635
|
README.md (this file)
|
|
584
636
|
docs/
|
|
585
637
|
├── CONCEPTS.md (theory & fundamentals)
|
|
586
|
-
├──
|
|
638
|
+
├── OVERVIEW.md (Data structures overview)
|
|
587
639
|
├── ARCHITECTURE.md (design principles)
|
|
588
640
|
├── PERFORMANCE.md (benchmarks)
|
|
589
641
|
├── GUIDES.md (real-world examples)
|
|
@@ -600,7 +652,7 @@ docs/
|
|
|
600
652
|
|
|
601
653
|
**Want to build?** → [GUIDES.md](./docs/GUIDES.md)
|
|
602
654
|
|
|
603
|
-
**Need API?** → [
|
|
655
|
+
**Need API?** → [API Docs](https://data-structure-typed-docs.vercel.app/) | [Overview](./docs/OVERVIEW.md)
|
|
604
656
|
|
|
605
657
|
**Curious about performance?** → [PERFORMANCE.md](./docs/PERFORMANCE.md)
|
|
606
658
|
|
|
@@ -609,3 +661,46 @@ docs/
|
|
|
609
661
|
---
|
|
610
662
|
|
|
611
663
|
**Ready to supercharge your TypeScript data structures? [Get started now →](#-quick-start-30-seconds)**
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## ❓ FAQ
|
|
668
|
+
|
|
669
|
+
### Does JavaScript have a TreeMap or TreeSet?
|
|
670
|
+
|
|
671
|
+
Not natively. JavaScript's `Map` and `Set` are hash-based (unordered). This library provides `TreeMap` and `TreeSet` backed by Red-Black Trees — offering sorted iteration, `floor`/`ceiling`/`higher`/`lower` lookups, and `getRank`/`getByRank`/`rangeByRank` queries.
|
|
672
|
+
|
|
673
|
+
### When should I use a Heap instead of sorting an array?
|
|
674
|
+
|
|
675
|
+
When you need to repeatedly access the smallest or largest element. Sorting an array is O(n log n) every time; a Heap gives you O(log n) insert and O(1) access to the top element. Use `Heap`, `MinHeap`, or `MaxHeap` for priority queues, top-k problems, and scheduling.
|
|
676
|
+
|
|
677
|
+
### Does this library support rank and range queries?
|
|
678
|
+
|
|
679
|
+
Yes. Enable with `{ enableOrderStatistic: true }` on any tree-based structure (RedBlackTree, TreeMap, TreeSet, etc.):
|
|
680
|
+
- `getRank(key)` — how many elements precede this key in tree order
|
|
681
|
+
- `getByRank(k)` — get the element at position k
|
|
682
|
+
- `rangeByRank(start, end)` — get all elements between two positions
|
|
683
|
+
|
|
684
|
+
### Is it faster than native arrays for ordered operations?
|
|
685
|
+
|
|
686
|
+
For ordered insert + lookup: yes. Array insert into sorted position is O(n) (shift elements). Red-Black Tree insert is O(log n). For 10,000+ elements, the difference is significant. See [PERFORMANCE.md](./docs/PERFORMANCE.md) for benchmarks.
|
|
687
|
+
|
|
688
|
+
### Can I use this in React / Node.js / browser?
|
|
689
|
+
|
|
690
|
+
Yes. The library ships ESM, CJS, and UMD builds. It works in Node.js, browsers, React, Vue, Angular, Next.js, and any JavaScript runtime. Zero dependencies means no compatibility concerns.
|
|
691
|
+
|
|
692
|
+
### What data structures are included?
|
|
693
|
+
|
|
694
|
+
Heap, MinHeap, MaxHeap, Priority Queue, Deque, Queue, Stack, Linked List (Singly / Doubly), Red-Black Tree, AVL Tree, BST, TreeMap, TreeSet, TreeMultiMap, TreeMultiSet, SkipList, Trie, HashMap, Graph (Directed / Undirected), Segment Tree, Binary Indexed Tree (Fenwick Tree), Matrix. See [full list](#-data-structures-available).
|
|
695
|
+
|
|
696
|
+
### Is this library production-ready?
|
|
697
|
+
|
|
698
|
+
Yes. 2600+ tests, 99%+ code coverage, zero dependencies, and used in production. Every release passes typecheck, lint, and full test suite.
|
|
699
|
+
|
|
700
|
+
### How does this compare to js-sdsl or other libraries?
|
|
701
|
+
|
|
702
|
+
`data-structure-typed` offers more data structures (20+), a unified Array-like API across all structures, tree-shakeable subpath exports, and active maintenance. See [PERFORMANCE.md](./docs/PERFORMANCE.md) for benchmark comparisons.
|
|
703
|
+
|
|
704
|
+
### What is the bundle size?
|
|
705
|
+
|
|
706
|
+
UMD bundle: ~143KB minified. With subpath imports (e.g., `data-structure-typed/heap`), you only load what you use — as small as 18KB for Stack, 30KB for Heap. `sideEffects: false` enables full tree-shaking.
|