data-structure-typed 2.5.1 → 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/CHANGELOG.md +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- 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/umd/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -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 +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -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
|
@@ -44,13 +44,32 @@ const features = [
|
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
title: '✅ Battle-Tested',
|
|
47
|
-
description: '
|
|
47
|
+
description: '2600+ tests, 99%+ coverage. CLRS-correct Red-Black Tree, ACL-style Segment Tree. Production-ready.',
|
|
48
48
|
},
|
|
49
49
|
];
|
|
50
50
|
|
|
51
|
+
const structures = [
|
|
52
|
+
{ category: 'Trees', items: 'RedBlackTree, AVLTree, BST, TreeMap, TreeSet, TreeMultiMap, TreeMultiSet' },
|
|
53
|
+
{ category: 'Heaps', items: 'Heap, MinHeap, MaxHeap, MinPriorityQueue, MaxPriorityQueue' },
|
|
54
|
+
{ category: 'Queues & Stacks', items: 'Queue, Deque, Stack' },
|
|
55
|
+
{ category: 'Linked Lists', items: 'SinglyLinkedList, DoublyLinkedList, SkipList' },
|
|
56
|
+
{ category: 'Hashing', items: 'HashMap' },
|
|
57
|
+
{ category: 'Graphs', items: 'DirectedGraph, UndirectedGraph' },
|
|
58
|
+
{ category: 'Strings', items: 'Trie' },
|
|
59
|
+
{ category: 'Arrays', items: 'SegmentTree, BinaryIndexedTree, Matrix' },
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
const useCases = [
|
|
63
|
+
{ title: 'Priority Queue', link: '/docs/guide/use-cases/priority-queue-typescript', desc: 'Task scheduling, top-k problems, Dijkstra' },
|
|
64
|
+
{ title: 'TreeMap / TreeSet', link: '/docs/guide/use-cases/treemap-javascript', desc: 'Sorted maps, floor/ceiling, range queries' },
|
|
65
|
+
{ title: 'Array + Sort Too Slow?', link: '/docs/guide/use-cases/array-sort-alternative', desc: 'O(log n) insert vs O(n log n) re-sort' },
|
|
66
|
+
{ title: 'Heap vs Sorting', link: '/docs/guide/use-cases/heap-vs-sorting', desc: 'When to use which' },
|
|
67
|
+
{ title: 'Map vs TreeMap', link: '/docs/guide/use-cases/map-vs-treemap', desc: 'When native Map isn\'t enough' },
|
|
68
|
+
];
|
|
69
|
+
|
|
51
70
|
export default function Home(): React.JSX.Element {
|
|
52
71
|
return (
|
|
53
|
-
<Layout title="Home" description="
|
|
72
|
+
<Layout title="Home" description="Production-ready TypeScript data structures library — Heap, TreeMap, TreeSet, Trie, Graph, Priority Queue, Deque, and more. Zero dependencies, type-safe, with rank and range query support.">
|
|
54
73
|
<HomepageHeader />
|
|
55
74
|
<main>
|
|
56
75
|
<section style={{padding: '4rem 0'}}>
|
|
@@ -65,6 +84,36 @@ export default function Home(): React.JSX.Element {
|
|
|
65
84
|
</div>
|
|
66
85
|
</div>
|
|
67
86
|
</section>
|
|
87
|
+
|
|
88
|
+
<section style={{padding: '2rem 0 4rem', background: 'var(--ifm-background-surface-color)'}}>
|
|
89
|
+
<div className="container">
|
|
90
|
+
<h2 style={{textAlign: 'center', marginBottom: '2rem'}}>📚 Data Structures Available</h2>
|
|
91
|
+
<div className="row" style={{justifyContent: 'center'}}>
|
|
92
|
+
{structures.map((s, i) => (
|
|
93
|
+
<div key={i} className={clsx('col col--6')} style={{marginBottom: '1.5rem'}}>
|
|
94
|
+
<h4>{s.category}</h4>
|
|
95
|
+
<p style={{color: 'var(--ifm-color-emphasis-700)', fontSize: '0.95rem'}}>{s.items}</p>
|
|
96
|
+
</div>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</section>
|
|
101
|
+
|
|
102
|
+
<section style={{padding: '4rem 0'}}>
|
|
103
|
+
<div className="container">
|
|
104
|
+
<h2 style={{textAlign: 'center', marginBottom: '2rem'}}>🎯 Use Cases & Guides</h2>
|
|
105
|
+
<div className="row" style={{justifyContent: 'center'}}>
|
|
106
|
+
{useCases.map((u, i) => (
|
|
107
|
+
<div key={i} className={clsx('col col--4')} style={{marginBottom: '1.5rem'}}>
|
|
108
|
+
<Link to={u.link} style={{textDecoration: 'none'}}>
|
|
109
|
+
<h4>{u.title}</h4>
|
|
110
|
+
<p style={{color: 'var(--ifm-color-emphasis-700)', fontSize: '0.9rem'}}>{u.desc}</p>
|
|
111
|
+
</Link>
|
|
112
|
+
</div>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</section>
|
|
68
117
|
</main>
|
|
69
118
|
</Layout>
|
|
70
119
|
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# data-structure-typed
|
|
2
|
+
|
|
3
|
+
> A production-ready TypeScript/JavaScript data structures library with zero dependencies.
|
|
4
|
+
|
|
5
|
+
## What it is
|
|
6
|
+
A comprehensive collection of 20+ data structures for TypeScript and JavaScript, with a unified API that feels like native Array. Includes Heap, Priority Queue, Deque, Trie, Graph, Red-Black Tree, TreeMap, TreeSet, SkipList, Segment Tree, Binary Indexed Tree, Matrix, and more.
|
|
7
|
+
|
|
8
|
+
## Key capabilities
|
|
9
|
+
- TreeMap / TreeSet: Sorted key-value and key-only collections (Red-Black Tree backed)
|
|
10
|
+
- Order-statistic operations: getRank(key), getByRank(k), rangeByRank(start, end)
|
|
11
|
+
- NavigableMap API: floor, ceiling, higher, lower, rangeSearch
|
|
12
|
+
- Priority Queue / Heap: MinHeap, MaxHeap, custom comparators
|
|
13
|
+
- Graph algorithms: Dijkstra, Bellman-Ford, Floyd-Warshall, Tarjan, topological sort, DFS, BFS
|
|
14
|
+
- Trie: Prefix search, autocomplete
|
|
15
|
+
- All structures support: forEach, filter, map, reduce, every, some, find, entries, keys, values
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
npm i data-structure-typed
|
|
19
|
+
|
|
20
|
+
## Links
|
|
21
|
+
- Documentation: https://data-structure-typed-docs.vercel.app/
|
|
22
|
+
- GitHub: https://github.com/zrwusa/data-structure-typed
|
|
23
|
+
- npm: https://www.npmjs.com/package/data-structure-typed
|
|
24
|
+
- Quick Start: https://data-structure-typed-docs.vercel.app/docs/guide/quick-start
|
|
25
|
+
- API Reference: https://data-structure-typed-docs.vercel.app/docs/api/
|
|
26
|
+
- Guides: https://data-structure-typed-docs.vercel.app/docs/guide/guides
|
|
27
|
+
- FAQ: https://github.com/zrwusa/data-structure-typed#-faq
|
|
28
|
+
|
|
29
|
+
## Common questions
|
|
30
|
+
- Does JavaScript have TreeMap? → Use TreeMap from this library (Red-Black Tree backed, sorted iteration, rank queries)
|
|
31
|
+
- Priority queue in TypeScript? → Use Heap, MinHeap, MaxHeap, or MinPriorityQueue/MaxPriorityQueue
|
|
32
|
+
- Sorted set / ordered set in JS? → Use TreeSet (maintains sorted order, supports floor/ceiling/range)
|
|
33
|
+
- How to find kth element efficiently? → Use getByRank(k) with enableOrderStatistic: true
|
|
34
|
+
- Alternative to repeatedly sorting arrays? → Use TreeMap/TreeSet for O(log n) insert with maintained order
|
|
35
|
+
- Bundle size? → ~143KB UMD min, tree-shakeable subpath imports (18KB–315KB per category)
|
|
36
|
+
- Zero dependencies? → Yes
|
|
37
|
+
- Production ready? → Yes, 2600+ tests, 99%+ coverage
|
package/llms.txt
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# data-structure-typed
|
|
2
|
+
|
|
3
|
+
> A production-ready TypeScript/JavaScript data structures library with zero dependencies.
|
|
4
|
+
|
|
5
|
+
## What it is
|
|
6
|
+
A comprehensive collection of 20+ data structures for TypeScript and JavaScript, with a unified API that feels like native Array. Includes Heap, Priority Queue, Deque, Trie, Graph, Red-Black Tree, TreeMap, TreeSet, SkipList, Segment Tree, Binary Indexed Tree, Matrix, and more.
|
|
7
|
+
|
|
8
|
+
## Key capabilities
|
|
9
|
+
- TreeMap / TreeSet: Sorted key-value and key-only collections (Red-Black Tree backed)
|
|
10
|
+
- Order-statistic operations: getRank(key), getByRank(k), rangeByRank(start, end)
|
|
11
|
+
- NavigableMap API: floor, ceiling, higher, lower, rangeSearch
|
|
12
|
+
- Priority Queue / Heap: MinHeap, MaxHeap, custom comparators
|
|
13
|
+
- Graph algorithms: Dijkstra, Bellman-Ford, Floyd-Warshall, Tarjan, topological sort, DFS, BFS
|
|
14
|
+
- Trie: Prefix search, autocomplete
|
|
15
|
+
- All structures support: forEach, filter, map, reduce, every, some, find, entries, keys, values
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
npm i data-structure-typed
|
|
19
|
+
|
|
20
|
+
## Links
|
|
21
|
+
- Documentation: https://data-structure-typed-docs.vercel.app/
|
|
22
|
+
- GitHub: https://github.com/zrwusa/data-structure-typed
|
|
23
|
+
- npm: https://www.npmjs.com/package/data-structure-typed
|
|
24
|
+
- Quick Start: https://data-structure-typed-docs.vercel.app/docs/guide/quick-start
|
|
25
|
+
- API Reference: https://data-structure-typed-docs.vercel.app/docs/api/
|
|
26
|
+
- Guides: https://data-structure-typed-docs.vercel.app/docs/guide/guides
|
|
27
|
+
- FAQ: https://github.com/zrwusa/data-structure-typed#-faq
|
|
28
|
+
|
|
29
|
+
## Common questions
|
|
30
|
+
- Does JavaScript have TreeMap? → Use TreeMap from this library (Red-Black Tree backed, sorted iteration, rank queries)
|
|
31
|
+
- Priority queue in TypeScript? → Use Heap, MinHeap, MaxHeap, or MinPriorityQueue/MaxPriorityQueue
|
|
32
|
+
- Sorted set / ordered set in JS? → Use TreeSet (maintains sorted order, supports floor/ceiling/range)
|
|
33
|
+
- How to find kth element efficiently? → Use getByRank(k) with enableOrderStatistic: true
|
|
34
|
+
- Alternative to repeatedly sorting arrays? → Use TreeMap/TreeSet for O(log n) insert with maintained order
|
|
35
|
+
- Bundle size? → ~143KB UMD min, tree-shakeable subpath imports (18KB–315KB per category)
|
|
36
|
+
- Zero dependencies? → Yes
|
|
37
|
+
- Production ready? → Yes, 2600+ tests, 99%+ coverage
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-structure-typed",
|
|
3
|
-
"version": "2.5.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.5.2",
|
|
4
|
+
"description": "Production-ready TypeScript data structures: Heap, Deque, Trie, Graph, Red-Black Tree, TreeMap, TreeSet, and more. Zero dependencies, type-safe, with getRank/getByRank/rangeByRank support.",
|
|
5
5
|
"browser": "dist/umd/data-structure-typed.min.js",
|
|
6
6
|
"umd:main": "dist/umd/data-structure-typed.min.js",
|
|
7
7
|
"main": "dist/cjs/index.cjs",
|
|
@@ -129,49 +129,45 @@
|
|
|
129
129
|
"npm": ">=6.14.0"
|
|
130
130
|
},
|
|
131
131
|
"scripts": {
|
|
132
|
-
"build": "npm run build:
|
|
132
|
+
"build": "npm run build:node && npm run build:types && npm run build:umd",
|
|
133
133
|
"build:node": "tsup",
|
|
134
134
|
"build:umd": "tsup --config tsup.umd.config.js",
|
|
135
135
|
"build:types": "rm -rf dist/types && tsc -p tsconfig.types.json",
|
|
136
|
-
"build:ecut": "npm run build:node && npm run build:types && npm run build:umd",
|
|
137
136
|
"build:leetcode": "tsup --config tsup.leetcode.config.js",
|
|
138
137
|
"build:typedoc-plugin": "tsc scripts/typedoc-plugin-example-rewrite.ts --outDir scripts --esModuleInterop --module commonjs --target es2020 --moduleResolution node --skipLibCheck",
|
|
139
|
-
"build:docs": "npm run gen:examples && npm run generate:schema && npm run build:typedoc-plugin && typedoc --plugin ./scripts/typedoc-plugin-example-rewrite.js --out docs/api ./src",
|
|
140
|
-
"build:docs-class": "npm run gen:examples && npm run build:typedoc-plugin && typedoc --plugin ./scripts/typedoc-plugin-example-rewrite.js --out docs/api ./src/data-structures",
|
|
141
138
|
"gen:examples": "ts-node scripts/test-to-example.ts",
|
|
142
|
-
"
|
|
143
|
-
"test": "
|
|
139
|
+
"generate:schema": "ts-node scripts/generate-schema.ts",
|
|
140
|
+
"test": "jest --runInBand",
|
|
141
|
+
"test:coverage": "jest --runInBand --coverage",
|
|
144
142
|
"test:integration": "npm run update:subs && jest --config jest.integration.config.js && tsc test/integration/compile.test.ts && node test/integration/compile.mjs",
|
|
145
|
-
"test:perf": "npm run build
|
|
143
|
+
"test:perf": "npm run build && NODE_OPTIONS='--expose-gc --max-old-space-size=8192' node test/performance/benchmark-runner-enhanced.mjs",
|
|
146
144
|
"test:perf:report": "node test/performance/reportor-enhanced.mjs",
|
|
147
|
-
"test:coverage": "jest --runInBand --coverage",
|
|
148
145
|
"check": "npm run check:src && npm run check:test",
|
|
149
146
|
"check:src": "tsc --noEmit",
|
|
150
147
|
"check:test": "tsc -p tsconfig.test.json --noEmit",
|
|
151
148
|
"check:circular-refs": "dependency-cruiser src",
|
|
149
|
+
"lint": "npm run lint:src && npm run lint:test",
|
|
152
150
|
"lint:src": "eslint --fix 'src/**/*.{js,ts}'",
|
|
153
151
|
"lint:test": "eslint --fix 'test/**/*.{js,ts}'",
|
|
154
|
-
"
|
|
155
|
-
"inspect": "npm run build && npm run check && npm run lint",
|
|
152
|
+
"format": "npm run format:src && npm run format:test",
|
|
156
153
|
"format:src": "prettier --write 'src/**/*.{js,ts}'",
|
|
157
154
|
"format:test": "prettier --write 'test/**/*.{js,ts}'",
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
155
|
+
"inspect": "npm run build && npm run check && npm run lint",
|
|
156
|
+
"ci": "env && git fetch --tags && npm run update:subs && npm run inspect && npm run test:coverage && npm run changelog",
|
|
157
|
+
"docs:api": "npm run gen:examples && npm run build:typedoc-plugin && cd docs-site-docusaurus && npx typedoc --options typedoc.json && node sort-protected.mjs",
|
|
158
|
+
"docs:dev": "cd docs-site-docusaurus && npm run start",
|
|
159
|
+
"docs:build": "cd docs-site-docusaurus && rm -rf docs/api && npx typedoc --options typedoc.json && node sort-protected.mjs && npm run build",
|
|
160
|
+
"docs:preview": "cd docs-site-docusaurus && npm run serve",
|
|
161
161
|
"update:subs": "npm i avl-tree-typed binary-tree-typed bst-typed heap-typed data-structure-typed --save-dev",
|
|
162
162
|
"install:all-subs": "npm i avl-tree-typed binary-tree-typed bst-typed deque-typed directed-graph-typed doubly-linked-list-typed graph-typed heap-typed linked-list-typed max-heap-typed max-priority-queue-typed min-heap-typed min-priority-queue-typed priority-queue-typed singly-linked-list-typed stack-typed tree-multimap-typed trie-typed undirected-graph-typed queue-typed --save-dev",
|
|
163
|
-
"changelog": "auto-changelog",
|
|
164
|
-
"coverage:badge": "istanbul-badges-readme",
|
|
165
|
-
"toc": "doctoc README.md",
|
|
166
163
|
"copy:to-subs": "sh scripts/copy_to_all_subs.sh",
|
|
167
164
|
"publish:subs": "npm run copy:to-subs && sh scripts/publish_all_subs.sh",
|
|
168
165
|
"publish:docs": "sh scripts/publish_docs.sh",
|
|
169
166
|
"publish:all": "npm run ci && npm publish && npm run publish:docs && npm run check:exist-latest && npm run publish:subs",
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"docs:preview": "cd docs-site-docusaurus && npm run serve"
|
|
167
|
+
"check:exist-latest": "sh scripts/check_exist_remotely.sh",
|
|
168
|
+
"changelog": "auto-changelog",
|
|
169
|
+
"coverage:badge": "istanbul-badges-readme",
|
|
170
|
+
"toc": "doctoc README.md"
|
|
175
171
|
},
|
|
176
172
|
"repository": {
|
|
177
173
|
"type": "git",
|
|
@@ -197,11 +193,11 @@
|
|
|
197
193
|
"@typescript-eslint/eslint-plugin": "^8.12.1",
|
|
198
194
|
"@typescript-eslint/parser": "^8.12.1",
|
|
199
195
|
"auto-changelog": "^2.5.0",
|
|
200
|
-
"avl-tree-typed": "^2.5.
|
|
196
|
+
"avl-tree-typed": "^2.5.1",
|
|
201
197
|
"benchmark": "^2.1.4",
|
|
202
|
-
"binary-tree-typed": "^2.5.
|
|
203
|
-
"bst-typed": "^2.5.
|
|
204
|
-
"data-structure-typed": "^2.5.
|
|
198
|
+
"binary-tree-typed": "^2.5.1",
|
|
199
|
+
"bst-typed": "^2.5.1",
|
|
200
|
+
"data-structure-typed": "^2.5.1",
|
|
205
201
|
"dependency-cruiser": "^16.5.0",
|
|
206
202
|
"doctoc": "^2.2.1",
|
|
207
203
|
"eslint": "^9.13.0",
|
|
@@ -210,7 +206,7 @@
|
|
|
210
206
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
211
207
|
"eslint-plugin-import": "^2.31.0",
|
|
212
208
|
"fast-glob": "^3.3.2",
|
|
213
|
-
"heap-typed": "^2.5.
|
|
209
|
+
"heap-typed": "^2.5.1",
|
|
214
210
|
"istanbul-badges-readme": "^1.9.0",
|
|
215
211
|
"jest": "^29.7.0",
|
|
216
212
|
"js-sdsl": "^4.4.2",
|
|
@@ -225,59 +221,71 @@
|
|
|
225
221
|
"typescript": "~5.9"
|
|
226
222
|
},
|
|
227
223
|
"keywords": [
|
|
228
|
-
"data structures
|
|
229
|
-
"
|
|
224
|
+
"data structures",
|
|
225
|
+
"typescript",
|
|
226
|
+
"javascript",
|
|
227
|
+
"data structures library",
|
|
230
228
|
"typescript data structures",
|
|
231
229
|
"javascript data structures",
|
|
232
|
-
"
|
|
233
|
-
"algorithm library",
|
|
230
|
+
"binary tree",
|
|
234
231
|
"binary search tree",
|
|
232
|
+
"BST",
|
|
235
233
|
"AVL tree",
|
|
236
234
|
"red black tree",
|
|
237
235
|
"tree map",
|
|
238
236
|
"tree set",
|
|
237
|
+
"treemap javascript",
|
|
238
|
+
"treeset javascript",
|
|
239
|
+
"sorted map",
|
|
240
|
+
"sorted set",
|
|
241
|
+
"ordered map",
|
|
242
|
+
"ordered set",
|
|
239
243
|
"tree multi map",
|
|
240
244
|
"tree multi set",
|
|
241
|
-
"balanced tree",
|
|
242
|
-
"binary tree",
|
|
243
|
-
"BST",
|
|
244
|
-
"graph algorithm",
|
|
245
|
-
"directed graph",
|
|
246
|
-
"undirected graph",
|
|
247
245
|
"heap",
|
|
248
|
-
"priority queue",
|
|
249
246
|
"min heap",
|
|
250
247
|
"max heap",
|
|
248
|
+
"priority queue",
|
|
251
249
|
"queue",
|
|
252
250
|
"deque",
|
|
251
|
+
"double ended queue",
|
|
253
252
|
"stack",
|
|
254
253
|
"linked list",
|
|
255
254
|
"singly linked list",
|
|
256
255
|
"doubly linked list",
|
|
256
|
+
"skip list",
|
|
257
257
|
"trie",
|
|
258
|
+
"prefix tree",
|
|
259
|
+
"graph",
|
|
260
|
+
"directed graph",
|
|
261
|
+
"undirected graph",
|
|
258
262
|
"hash map",
|
|
259
263
|
"hash table",
|
|
260
|
-
"tree
|
|
261
|
-
"tree
|
|
262
|
-
"tree
|
|
263
|
-
"
|
|
264
|
-
"
|
|
265
|
-
"
|
|
266
|
-
"
|
|
267
|
-
"
|
|
268
|
-
"
|
|
269
|
-
"
|
|
270
|
-
"dijkstra
|
|
264
|
+
"segment tree",
|
|
265
|
+
"binary indexed tree",
|
|
266
|
+
"fenwick tree",
|
|
267
|
+
"matrix",
|
|
268
|
+
"rank query",
|
|
269
|
+
"range query",
|
|
270
|
+
"order statistic tree",
|
|
271
|
+
"getRank",
|
|
272
|
+
"getByRank",
|
|
273
|
+
"rangeByRank",
|
|
274
|
+
"dijkstra",
|
|
271
275
|
"bellman ford",
|
|
272
|
-
"floyd warshall",
|
|
273
|
-
"tarjan algorithm",
|
|
274
276
|
"topological sort",
|
|
277
|
+
"DFS",
|
|
278
|
+
"BFS",
|
|
275
279
|
"leetcode",
|
|
276
280
|
"coding interview",
|
|
277
|
-
"algorithm
|
|
278
|
-
"
|
|
279
|
-
"
|
|
281
|
+
"algorithm",
|
|
282
|
+
"zero dependency",
|
|
283
|
+
"production ready",
|
|
284
|
+
"type safe",
|
|
285
|
+
"ES6",
|
|
280
286
|
"CommonJS",
|
|
281
|
-
"
|
|
287
|
+
"UMD",
|
|
288
|
+
"collection",
|
|
289
|
+
"sorted collection"
|
|
282
290
|
]
|
|
283
291
|
}
|
package/src/common/error.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error dispatch.
|
|
3
|
+
* All library errors go through this function for consistent messaging and easy grep.
|
|
4
|
+
* @remarks Always throws — data structure errors are never recoverable.
|
|
5
|
+
* @param ErrorClass - The error constructor (Error, TypeError, RangeError, etc.)
|
|
6
|
+
* @param message - The error message.
|
|
7
|
+
*/
|
|
8
|
+
export function raise(
|
|
9
|
+
ErrorClass: new (msg: string) => Error,
|
|
10
|
+
message: string
|
|
11
|
+
): never {
|
|
12
|
+
throw new ErrorClass(message);
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* Centralized error message templates.
|
|
3
17
|
* Keep using native Error/TypeError/RangeError — this only standardizes messages.
|
|
@@ -56,5 +70,9 @@ export const ERR = {
|
|
|
56
70
|
'Matrix: Must be rectangular for transposition.',
|
|
57
71
|
|
|
58
72
|
matrixRowMismatch: (expected: number, got: number) =>
|
|
59
|
-
`Matrix: Expected row length ${expected}, but got ${got}
|
|
73
|
+
`Matrix: Expected row length ${expected}, but got ${got}.`,
|
|
74
|
+
|
|
75
|
+
// Order statistic
|
|
76
|
+
orderStatisticNotEnabled: (method: string, ctx?: string) =>
|
|
77
|
+
`${ctx ? ctx + ': ' : ''}${method}() requires enableOrderStatistic: true.`
|
|
60
78
|
} as const;
|
package/src/common/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ElementCallback, IterableElementBaseOptions, ReduceElementCallback } from '../../types';
|
|
2
|
+
import { raise } from '../../common';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Base class that makes a data structure iterable and provides common
|
|
@@ -25,7 +26,7 @@ export abstract class IterableElementBase<E, R> implements Iterable<E> {
|
|
|
25
26
|
if (options) {
|
|
26
27
|
const { toElementFn } = options;
|
|
27
28
|
if (typeof toElementFn === 'function') this._toElementFn = toElementFn;
|
|
28
|
-
else if (toElementFn)
|
|
29
|
+
else if (toElementFn) raise(TypeError, 'toElementFn must be a function type');
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -224,7 +225,7 @@ export abstract class IterableElementBase<E, R> implements Iterable<E> {
|
|
|
224
225
|
acc = initialValue as U;
|
|
225
226
|
} else {
|
|
226
227
|
const first = iter.next();
|
|
227
|
-
if (first.done)
|
|
228
|
+
if (first.done) raise(TypeError, 'Reduce of empty structure with no initial value');
|
|
228
229
|
acc = first.value as unknown as U;
|
|
229
230
|
index = 1;
|
|
230
231
|
}
|
|
@@ -467,6 +467,18 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
467
467
|
|
|
468
468
|
|
|
469
469
|
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
470
482
|
|
|
471
483
|
|
|
472
484
|
|
|
@@ -590,6 +602,15 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
590
602
|
|
|
591
603
|
|
|
592
604
|
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
593
614
|
|
|
594
615
|
|
|
595
616
|
|
|
@@ -674,6 +695,12 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
674
695
|
|
|
675
696
|
|
|
676
697
|
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
677
704
|
|
|
678
705
|
|
|
679
706
|
|
|
@@ -805,6 +832,15 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
805
832
|
|
|
806
833
|
|
|
807
834
|
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
808
844
|
|
|
809
845
|
|
|
810
846
|
|
|
@@ -970,6 +1006,8 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
970
1006
|
}
|
|
971
1007
|
this._updateHeight(A);
|
|
972
1008
|
if (B) this._updateHeight(B);
|
|
1009
|
+
this._updateCount(A);
|
|
1010
|
+
if (B) this._updateCount(B);
|
|
973
1011
|
}
|
|
974
1012
|
|
|
975
1013
|
/**
|
|
@@ -1022,6 +1060,9 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
1022
1060
|
this._updateHeight(A);
|
|
1023
1061
|
if (B) this._updateHeight(B);
|
|
1024
1062
|
if (C) this._updateHeight(C);
|
|
1063
|
+
this._updateCount(A);
|
|
1064
|
+
if (B) this._updateCount(B);
|
|
1065
|
+
if (C) this._updateCount(C);
|
|
1025
1066
|
}
|
|
1026
1067
|
|
|
1027
1068
|
/**
|
|
@@ -1061,6 +1102,8 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
1061
1102
|
}
|
|
1062
1103
|
this._updateHeight(A);
|
|
1063
1104
|
if (B) this._updateHeight(B);
|
|
1105
|
+
this._updateCount(A);
|
|
1106
|
+
if (B) this._updateCount(B);
|
|
1064
1107
|
}
|
|
1065
1108
|
|
|
1066
1109
|
/**
|
|
@@ -1112,6 +1155,9 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
1112
1155
|
this._updateHeight(A);
|
|
1113
1156
|
if (B) this._updateHeight(B);
|
|
1114
1157
|
if (C) this._updateHeight(C);
|
|
1158
|
+
this._updateCount(A);
|
|
1159
|
+
if (B) this._updateCount(B);
|
|
1160
|
+
if (C) this._updateCount(C);
|
|
1115
1161
|
}
|
|
1116
1162
|
|
|
1117
1163
|
/**
|
|
@@ -1130,6 +1176,7 @@ export class AVLTree<K = any, V = any, R = any> extends BST<K, V, R> implements
|
|
|
1130
1176
|
const A = path[i];
|
|
1131
1177
|
if (A) {
|
|
1132
1178
|
this._updateHeight(A);
|
|
1179
|
+
this._updateCount(A);
|
|
1133
1180
|
|
|
1134
1181
|
// Check the balance factor
|
|
1135
1182
|
switch (this._balanceFactor(A)) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import { ERR } from '../../common';
|
|
8
|
+
import { ERR, raise } from '../../common';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Binary Indexed Tree (Fenwick Tree).
|
|
@@ -44,7 +44,7 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
44
44
|
}
|
|
45
45
|
} else {
|
|
46
46
|
if (!Number.isInteger(sizeOrElements) || sizeOrElements < 0) {
|
|
47
|
-
|
|
47
|
+
raise(RangeError, ERR.invalidArgument('size must be a non-negative integer', 'BinaryIndexedTree'));
|
|
48
48
|
}
|
|
49
49
|
this._size = sizeOrElements;
|
|
50
50
|
this._tree = new Array(this._size + 1).fill(0);
|
|
@@ -105,6 +105,12 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
108
114
|
|
|
109
115
|
|
|
110
116
|
|
|
@@ -176,6 +182,12 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
176
182
|
|
|
177
183
|
|
|
178
184
|
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
179
191
|
|
|
180
192
|
|
|
181
193
|
|
|
@@ -247,6 +259,12 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
247
259
|
|
|
248
260
|
|
|
249
261
|
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
250
268
|
|
|
251
269
|
|
|
252
270
|
|
|
@@ -318,6 +336,12 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
318
336
|
|
|
319
337
|
|
|
320
338
|
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
321
345
|
|
|
322
346
|
|
|
323
347
|
|
|
@@ -387,6 +411,12 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
387
411
|
|
|
388
412
|
|
|
389
413
|
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
390
420
|
|
|
391
421
|
|
|
392
422
|
|
|
@@ -464,6 +494,12 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
464
494
|
|
|
465
495
|
|
|
466
496
|
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
467
503
|
|
|
468
504
|
|
|
469
505
|
|
|
@@ -517,6 +553,9 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
517
553
|
|
|
518
554
|
|
|
519
555
|
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
520
559
|
|
|
521
560
|
|
|
522
561
|
|
|
@@ -583,6 +622,9 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
583
622
|
|
|
584
623
|
|
|
585
624
|
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
586
628
|
|
|
587
629
|
|
|
588
630
|
|
|
@@ -665,10 +707,10 @@ export class BinaryIndexedTree implements Iterable<number> {
|
|
|
665
707
|
|
|
666
708
|
protected _checkIndex(index: number): void {
|
|
667
709
|
if (!Number.isInteger(index)) {
|
|
668
|
-
|
|
710
|
+
raise(TypeError, ERR.invalidIndex('BinaryIndexedTree'));
|
|
669
711
|
}
|
|
670
712
|
if (index < 0 || index >= this._size) {
|
|
671
|
-
|
|
713
|
+
raise(RangeError, ERR.indexOutOfRange(index, 0, this._size - 1, 'BinaryIndexedTree'));
|
|
672
714
|
}
|
|
673
715
|
}
|
|
674
716
|
|