heap-typed 1.38.0 → 1.38.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/dist/data-structures/binary-tree/avl-tree.d.ts +9 -9
- package/dist/data-structures/binary-tree/avl-tree.js +22 -22
- package/dist/data-structures/binary-tree/binary-tree.d.ts +31 -31
- package/dist/data-structures/binary-tree/binary-tree.js +32 -32
- package/dist/data-structures/binary-tree/rb-tree.d.ts +1 -1
- package/dist/data-structures/binary-tree/tree-multiset.d.ts +9 -9
- package/dist/data-structures/binary-tree/tree-multiset.js +23 -23
- package/dist/data-structures/hash/hash-map.d.ts +25 -25
- package/dist/data-structures/hash/hash-map.js +59 -59
- package/dist/data-structures/hash/hash-table.d.ts +34 -34
- package/dist/data-structures/hash/hash-table.js +99 -99
- package/dist/data-structures/heap/heap.d.ts +66 -66
- package/dist/data-structures/heap/heap.js +167 -167
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +1 -1
- package/dist/data-structures/linked-list/doubly-linked-list.js +3 -3
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +17 -17
- package/dist/data-structures/linked-list/skip-linked-list.js +34 -34
- package/dist/data-structures/matrix/matrix2d.d.ts +7 -7
- package/dist/data-structures/matrix/matrix2d.js +9 -9
- package/dist/data-structures/trie/trie.d.ts +2 -2
- package/dist/data-structures/trie/trie.js +6 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/package.json +1 -4
- package/src/data-structures/binary-tree/avl-tree.ts +28 -28
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +1 -1
- package/src/data-structures/binary-tree/binary-tree.ts +57 -57
- package/src/data-structures/binary-tree/bst.ts +4 -0
- package/src/data-structures/binary-tree/rb-tree.ts +2 -2
- package/src/data-structures/binary-tree/tree-multiset.ts +30 -31
- package/src/data-structures/graph/abstract-graph.ts +10 -11
- package/src/data-structures/graph/directed-graph.ts +1 -2
- package/src/data-structures/graph/undirected-graph.ts +4 -5
- package/src/data-structures/hash/hash-map.ts +82 -76
- package/src/data-structures/hash/hash-table.ts +112 -109
- package/src/data-structures/hash/tree-map.ts +2 -1
- package/src/data-structures/hash/tree-set.ts +2 -1
- package/src/data-structures/heap/heap.ts +182 -181
- package/src/data-structures/linked-list/doubly-linked-list.ts +4 -4
- package/src/data-structures/linked-list/singly-linked-list.ts +1 -1
- package/src/data-structures/linked-list/skip-linked-list.ts +45 -38
- package/src/data-structures/matrix/matrix.ts +1 -1
- package/src/data-structures/matrix/matrix2d.ts +10 -10
- package/src/data-structures/matrix/vector2d.ts +2 -1
- package/src/data-structures/queue/deque.ts +5 -4
- package/src/data-structures/queue/queue.ts +1 -1
- package/src/data-structures/trie/trie.ts +9 -9
- package/src/index.ts +3 -3
- package/src/types/data-structures/matrix/navigator.ts +1 -1
- package/src/types/helpers.ts +5 -1
- package/src/types/utils/utils.ts +1 -1
- package/src/types/utils/validate-type.ts +2 -2
|
@@ -52,6 +52,8 @@ export class TrieNode {
|
|
|
52
52
|
* Trie represents a Trie data structure. It provides basic Trie operations and additional methods.
|
|
53
53
|
*/
|
|
54
54
|
export class Trie {
|
|
55
|
+
private readonly _caseSensitive: boolean;
|
|
56
|
+
|
|
55
57
|
constructor(words?: string[], caseSensitive = true) {
|
|
56
58
|
this._root = new TrieNode('');
|
|
57
59
|
this._caseSensitive = caseSensitive;
|
|
@@ -72,8 +74,6 @@ export class Trie {
|
|
|
72
74
|
this._root = v;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
private readonly _caseSensitive: boolean;
|
|
76
|
-
|
|
77
77
|
/**
|
|
78
78
|
* Add a word to the Trie structure.
|
|
79
79
|
* @param {string} word - The word to add.
|
|
@@ -110,13 +110,6 @@ export class Trie {
|
|
|
110
110
|
return cur.isEnd;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
private _caseProcess(str: string) {
|
|
114
|
-
if (!this._caseSensitive) {
|
|
115
|
-
str = str.toLowerCase(); // Convert str to lowercase if case-insensitive
|
|
116
|
-
}
|
|
117
|
-
return str;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
113
|
/**
|
|
121
114
|
* Remove a word from the Trie structure.
|
|
122
115
|
* @param{string} word - The word to delete.
|
|
@@ -282,5 +275,12 @@ export class Trie {
|
|
|
282
275
|
return words;
|
|
283
276
|
}
|
|
284
277
|
|
|
278
|
+
private _caseProcess(str: string) {
|
|
279
|
+
if (!this._caseSensitive) {
|
|
280
|
+
str = str.toLowerCase(); // Convert str to lowercase if case-insensitive
|
|
281
|
+
}
|
|
282
|
+
return str;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
285
|
// --- end additional methods ---
|
|
286
286
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
// export { Heap, MaxHeap, MinHeap } from 'data-structure-typed';
|
|
9
|
-
export * from 'data-
|
|
10
|
-
export * from '
|
|
11
|
-
export * from '
|
|
9
|
+
export * from './data-structures/heap';
|
|
10
|
+
export * from './types/data-structures/heap';
|
|
11
|
+
export * from './types/helpers';
|
package/src/types/helpers.ts
CHANGED
package/src/types/utils/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ToThunkFn = () => ReturnType<TrlFn>;
|
|
2
|
-
export type Thunk = () => ReturnType<ToThunkFn> & {__THUNK__: symbol};
|
|
2
|
+
export type Thunk = () => ReturnType<ToThunkFn> & { __THUNK__: symbol };
|
|
3
3
|
export type TrlFn = (...args: any[]) => any;
|
|
4
4
|
export type TrlAsyncFn = (...args: any[]) => any;
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type KeyValueObject = {[key: string]: any};
|
|
1
|
+
export type KeyValueObject = { [key: string]: any };
|
|
2
2
|
|
|
3
|
-
export type KeyValueObjectWithKey = {[key: string]: any; key: string | number | symbol};
|
|
3
|
+
export type KeyValueObjectWithKey = { [key: string]: any; key: string | number | symbol };
|
|
4
4
|
|
|
5
5
|
export type NonNumberNonObjectButDefined = string | boolean | symbol | null;
|
|
6
6
|
|