binary-tree-typed 1.53.8 → 1.54.1
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/base/iterable-entry-base.js +4 -4
- package/dist/data-structures/binary-tree/avl-tree-counter.d.ts +213 -0
- package/dist/data-structures/binary-tree/avl-tree-counter.js +407 -0
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +71 -170
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +133 -328
- package/dist/data-structures/binary-tree/avl-tree.d.ts +103 -69
- package/dist/data-structures/binary-tree/avl-tree.js +130 -70
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +3 -0
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +3 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +268 -202
- package/dist/data-structures/binary-tree/binary-tree.js +311 -263
- package/dist/data-structures/binary-tree/bst.d.ts +145 -121
- package/dist/data-structures/binary-tree/bst.js +195 -145
- package/dist/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/data-structures/binary-tree/index.js +2 -0
- package/dist/data-structures/binary-tree/red-black-tree.d.ts +100 -72
- package/dist/data-structures/binary-tree/red-black-tree.js +127 -107
- package/dist/data-structures/binary-tree/tree-counter.d.ts +212 -0
- package/dist/data-structures/binary-tree/tree-counter.js +444 -0
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +78 -170
- package/dist/data-structures/binary-tree/tree-multi-map.js +140 -362
- package/dist/data-structures/graph/abstract-graph.js +2 -2
- package/dist/data-structures/graph/directed-graph.d.ts +3 -0
- package/dist/data-structures/graph/directed-graph.js +3 -0
- package/dist/data-structures/graph/map-graph.d.ts +3 -0
- package/dist/data-structures/graph/map-graph.js +3 -0
- package/dist/data-structures/graph/undirected-graph.d.ts +3 -0
- package/dist/data-structures/graph/undirected-graph.js +3 -0
- package/dist/data-structures/hash/hash-map.d.ts +1 -1
- package/dist/data-structures/hash/hash-map.js +5 -5
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +10 -10
- package/dist/data-structures/linked-list/doubly-linked-list.js +12 -12
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +13 -10
- package/dist/data-structures/linked-list/singly-linked-list.js +19 -16
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +3 -0
- package/dist/data-structures/linked-list/skip-linked-list.js +3 -0
- package/dist/data-structures/matrix/matrix.d.ts +3 -0
- package/dist/data-structures/matrix/matrix.js +3 -0
- package/dist/data-structures/matrix/navigator.d.ts +3 -0
- package/dist/data-structures/matrix/navigator.js +3 -0
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +3 -0
- package/dist/data-structures/priority-queue/max-priority-queue.js +3 -0
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +3 -0
- package/dist/data-structures/priority-queue/min-priority-queue.js +3 -0
- package/dist/data-structures/trie/trie.d.ts +0 -4
- package/dist/data-structures/trie/trie.js +0 -4
- package/dist/interfaces/binary-tree.d.ts +8 -8
- package/dist/types/data-structures/base/base.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree-counter.js +2 -0
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -4
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -3
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +0 -3
- package/dist/types/data-structures/binary-tree/bst.d.ts +4 -4
- package/dist/types/data-structures/binary-tree/index.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/index.js +2 -0
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +2 -5
- package/dist/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
- package/dist/types/data-structures/binary-tree/tree-counter.js +2 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -5
- package/package.json +2 -2
- package/src/data-structures/base/iterable-entry-base.ts +4 -4
- package/src/data-structures/binary-tree/avl-tree-counter.ts +463 -0
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +151 -370
- package/src/data-structures/binary-tree/avl-tree.ts +162 -105
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -0
- package/src/data-structures/binary-tree/binary-tree.ts +488 -416
- package/src/data-structures/binary-tree/bst.ts +270 -234
- package/src/data-structures/binary-tree/index.ts +2 -0
- package/src/data-structures/binary-tree/red-black-tree.ts +170 -145
- package/src/data-structures/binary-tree/tree-counter.ts +504 -0
- package/src/data-structures/binary-tree/tree-multi-map.ts +159 -401
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +3 -0
- package/src/data-structures/graph/map-graph.ts +3 -0
- package/src/data-structures/graph/undirected-graph.ts +3 -0
- package/src/data-structures/hash/hash-map.ts +7 -7
- package/src/data-structures/linked-list/doubly-linked-list.ts +13 -13
- package/src/data-structures/linked-list/singly-linked-list.ts +20 -17
- package/src/data-structures/linked-list/skip-linked-list.ts +3 -0
- package/src/data-structures/matrix/matrix.ts +3 -0
- package/src/data-structures/matrix/navigator.ts +3 -0
- package/src/data-structures/priority-queue/max-priority-queue.ts +3 -0
- package/src/data-structures/priority-queue/min-priority-queue.ts +3 -0
- package/src/data-structures/trie/trie.ts +0 -4
- package/src/interfaces/binary-tree.ts +10 -21
- package/src/types/data-structures/base/base.ts +1 -1
- package/src/types/data-structures/binary-tree/avl-tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -6
- package/src/types/data-structures/binary-tree/avl-tree.ts +0 -5
- package/src/types/data-structures/binary-tree/binary-tree.ts +0 -5
- package/src/types/data-structures/binary-tree/bst.ts +6 -6
- package/src/types/data-structures/binary-tree/index.ts +2 -0
- package/src/types/data-structures/binary-tree/rb-tree.ts +2 -7
- package/src/types/data-structures/binary-tree/tree-counter.ts +3 -0
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -7
|
@@ -450,7 +450,7 @@ export declare class LinkedHashMap<K = any, V = any, R = [K, V]> extends Iterabl
|
|
|
450
450
|
* @returns a new `LinkedHashMap` object with the values mapped according to the provided callback
|
|
451
451
|
* function.
|
|
452
452
|
*/
|
|
453
|
-
map<
|
|
453
|
+
map<MK, MV>(callback: EntryCallback<K, V, [MK, MV]>, thisArg?: any): LinkedHashMap<MK, MV>;
|
|
454
454
|
/**
|
|
455
455
|
* Time Complexity: O(n)
|
|
456
456
|
* Space Complexity: O(1)
|
|
@@ -261,7 +261,7 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
261
261
|
const resultMap = new HashMap();
|
|
262
262
|
let index = 0;
|
|
263
263
|
for (const [key, value] of this) {
|
|
264
|
-
resultMap.set(key, callbackfn.call(thisArg,
|
|
264
|
+
resultMap.set(key, callbackfn.call(thisArg, key, value, index++, this));
|
|
265
265
|
}
|
|
266
266
|
return resultMap;
|
|
267
267
|
}
|
|
@@ -285,7 +285,7 @@ class HashMap extends base_1.IterableEntryBase {
|
|
|
285
285
|
const filteredMap = new HashMap();
|
|
286
286
|
let index = 0;
|
|
287
287
|
for (const [key, value] of this) {
|
|
288
|
-
if (predicate.call(thisArg,
|
|
288
|
+
if (predicate.call(thisArg, key, value, index++, this)) {
|
|
289
289
|
filteredMap.set(key, value);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
@@ -758,7 +758,7 @@ class LinkedHashMap extends base_1.IterableEntryBase {
|
|
|
758
758
|
const filteredMap = new LinkedHashMap();
|
|
759
759
|
let index = 0;
|
|
760
760
|
for (const [key, value] of this) {
|
|
761
|
-
if (predicate.call(thisArg,
|
|
761
|
+
if (predicate.call(thisArg, key, value, index, this)) {
|
|
762
762
|
filteredMap.set(key, value);
|
|
763
763
|
}
|
|
764
764
|
index++;
|
|
@@ -786,8 +786,8 @@ class LinkedHashMap extends base_1.IterableEntryBase {
|
|
|
786
786
|
const mappedMap = new LinkedHashMap();
|
|
787
787
|
let index = 0;
|
|
788
788
|
for (const [key, value] of this) {
|
|
789
|
-
const newValue = callback.call(thisArg,
|
|
790
|
-
mappedMap.set(
|
|
789
|
+
const [newKey, newValue] = callback.call(thisArg, key, value, index, this);
|
|
790
|
+
mappedMap.set(newKey, newValue);
|
|
791
791
|
index++;
|
|
792
792
|
}
|
|
793
793
|
return mappedMap;
|
|
@@ -533,6 +533,16 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
533
533
|
* @returns The method `get last()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
|
|
534
534
|
*/
|
|
535
535
|
get last(): E | undefined;
|
|
536
|
+
/**
|
|
537
|
+
* Time Complexity: O(n)
|
|
538
|
+
* Space Complexity: O(n)
|
|
539
|
+
*
|
|
540
|
+
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
541
|
+
* given array.
|
|
542
|
+
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
543
|
+
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
544
|
+
*/
|
|
545
|
+
static fromArray<E>(data: E[]): DoublyLinkedList<E, any>;
|
|
536
546
|
/**
|
|
537
547
|
* Time Complexity: O(1)
|
|
538
548
|
* Space Complexity: O(1)
|
|
@@ -867,16 +877,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
867
877
|
* node, or predicate function in the doubly linked list.
|
|
868
878
|
*/
|
|
869
879
|
countOccurrences(elementOrNode: E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)): number;
|
|
870
|
-
/**
|
|
871
|
-
* Time Complexity: O(n)
|
|
872
|
-
* Space Complexity: O(n)
|
|
873
|
-
*
|
|
874
|
-
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
875
|
-
* given array.
|
|
876
|
-
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
877
|
-
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
878
|
-
*/
|
|
879
|
-
static fromArray<E>(data: E[]): DoublyLinkedList<E, any>;
|
|
880
880
|
/**
|
|
881
881
|
* The function returns an iterator that iterates over the values of a linked list.
|
|
882
882
|
*/
|
|
@@ -557,6 +557,18 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
557
557
|
var _a;
|
|
558
558
|
return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
|
|
559
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Time Complexity: O(n)
|
|
562
|
+
* Space Complexity: O(n)
|
|
563
|
+
*
|
|
564
|
+
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
565
|
+
* given array.
|
|
566
|
+
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
567
|
+
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
568
|
+
*/
|
|
569
|
+
static fromArray(data) {
|
|
570
|
+
return new DoublyLinkedList(data);
|
|
571
|
+
}
|
|
560
572
|
/**
|
|
561
573
|
* Time Complexity: O(1)
|
|
562
574
|
* Space Complexity: O(1)
|
|
@@ -1184,18 +1196,6 @@ class DoublyLinkedList extends base_1.IterableElementBase {
|
|
|
1184
1196
|
}
|
|
1185
1197
|
return count;
|
|
1186
1198
|
}
|
|
1187
|
-
/**
|
|
1188
|
-
* Time Complexity: O(n)
|
|
1189
|
-
* Space Complexity: O(n)
|
|
1190
|
-
*
|
|
1191
|
-
* The `fromArray` function creates a new instance of a DoublyLinkedList and populates it with the elements from the
|
|
1192
|
-
* given array.
|
|
1193
|
-
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
1194
|
-
* @returns The `fromArray` function returns a DoublyLinkedList object.
|
|
1195
|
-
*/
|
|
1196
|
-
static fromArray(data) {
|
|
1197
|
-
return new DoublyLinkedList(data);
|
|
1198
|
-
}
|
|
1199
1199
|
/**
|
|
1200
1200
|
* The function returns an iterator that iterates over the values of a linked list.
|
|
1201
1201
|
*/
|
|
@@ -40,6 +40,9 @@ export declare class SinglyLinkedListNode<E = any> {
|
|
|
40
40
|
*/
|
|
41
41
|
set next(value: SinglyLinkedListNode<E> | undefined);
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
43
46
|
export declare class SinglyLinkedList<E = any, R = any> extends IterableElementBase<E, R, SinglyLinkedList<E, R>> {
|
|
44
47
|
constructor(elements?: Iterable<E> | Iterable<R> | Iterable<SinglyLinkedListNode<E>>, options?: SinglyLinkedListOptions<E, R>);
|
|
45
48
|
protected _head: SinglyLinkedListNode<E> | undefined;
|
|
@@ -72,6 +75,16 @@ export declare class SinglyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
72
75
|
* @returns The size of the object, which is a number.
|
|
73
76
|
*/
|
|
74
77
|
get size(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Time Complexity: O(n)
|
|
80
|
+
* Space Complexity: O(n)
|
|
81
|
+
*
|
|
82
|
+
* The `fromArray` function creates a new SinglyLinkedList instance and populates it with the elements from the given
|
|
83
|
+
* array.
|
|
84
|
+
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
85
|
+
* @returns The `fromArray` function returns a `SinglyLinkedList` object.
|
|
86
|
+
*/
|
|
87
|
+
static fromArray<E>(data: E[]): SinglyLinkedList<E, any>;
|
|
75
88
|
/**
|
|
76
89
|
* Time Complexity: O(1)
|
|
77
90
|
* Space Complexity: O(1)
|
|
@@ -384,16 +397,6 @@ export declare class SinglyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
384
397
|
* The function `_getIterator` returns an iterable iterator that yields the values of a linked list.
|
|
385
398
|
*/
|
|
386
399
|
protected _getIterator(): IterableIterator<E>;
|
|
387
|
-
/**
|
|
388
|
-
* Time Complexity: O(n)
|
|
389
|
-
* Space Complexity: O(n)
|
|
390
|
-
*
|
|
391
|
-
* The `fromArray` function creates a new SinglyLinkedList instance and populates it with the elements from the given
|
|
392
|
-
* array.
|
|
393
|
-
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
394
|
-
* @returns The `fromArray` function returns a `SinglyLinkedList` object.
|
|
395
|
-
*/
|
|
396
|
-
static fromArray<E>(data: E[]): SinglyLinkedList<E, any>;
|
|
397
400
|
/**
|
|
398
401
|
* The _isPredicate function in TypeScript checks if the input is a function that takes a
|
|
399
402
|
* SinglyLinkedListNode as an argument and returns a boolean.
|
|
@@ -45,6 +45,9 @@ class SinglyLinkedListNode {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.SinglyLinkedListNode = SinglyLinkedListNode;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
48
51
|
class SinglyLinkedList extends base_1.IterableElementBase {
|
|
49
52
|
constructor(elements = [], options) {
|
|
50
53
|
super(options);
|
|
@@ -90,6 +93,22 @@ class SinglyLinkedList extends base_1.IterableElementBase {
|
|
|
90
93
|
get size() {
|
|
91
94
|
return this._size;
|
|
92
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Time Complexity: O(n)
|
|
98
|
+
* Space Complexity: O(n)
|
|
99
|
+
*
|
|
100
|
+
* The `fromArray` function creates a new SinglyLinkedList instance and populates it with the elements from the given
|
|
101
|
+
* array.
|
|
102
|
+
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
103
|
+
* @returns The `fromArray` function returns a `SinglyLinkedList` object.
|
|
104
|
+
*/
|
|
105
|
+
static fromArray(data) {
|
|
106
|
+
const singlyLinkedList = new SinglyLinkedList();
|
|
107
|
+
for (const item of data) {
|
|
108
|
+
singlyLinkedList.push(item);
|
|
109
|
+
}
|
|
110
|
+
return singlyLinkedList;
|
|
111
|
+
}
|
|
93
112
|
/**
|
|
94
113
|
* Time Complexity: O(1)
|
|
95
114
|
* Space Complexity: O(1)
|
|
@@ -690,22 +709,6 @@ class SinglyLinkedList extends base_1.IterableElementBase {
|
|
|
690
709
|
current = current.next;
|
|
691
710
|
}
|
|
692
711
|
}
|
|
693
|
-
/**
|
|
694
|
-
* Time Complexity: O(n)
|
|
695
|
-
* Space Complexity: O(n)
|
|
696
|
-
*
|
|
697
|
-
* The `fromArray` function creates a new SinglyLinkedList instance and populates it with the elements from the given
|
|
698
|
-
* array.
|
|
699
|
-
* @param {E[]} data - The `data` parameter is an array of elements of type `E`.
|
|
700
|
-
* @returns The `fromArray` function returns a `SinglyLinkedList` object.
|
|
701
|
-
*/
|
|
702
|
-
static fromArray(data) {
|
|
703
|
-
const singlyLinkedList = new SinglyLinkedList();
|
|
704
|
-
for (const item of data) {
|
|
705
|
-
singlyLinkedList.push(item);
|
|
706
|
-
}
|
|
707
|
-
return singlyLinkedList;
|
|
708
|
-
}
|
|
709
712
|
/**
|
|
710
713
|
* The _isPredicate function in TypeScript checks if the input is a function that takes a
|
|
711
714
|
* SinglyLinkedListNode as an argument and returns a boolean.
|
|
@@ -12,6 +12,9 @@ export declare class SkipListNode<K, V> {
|
|
|
12
12
|
forward: SkipListNode<K, V>[];
|
|
13
13
|
constructor(key: K, value: V, level: number);
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
15
18
|
export declare class SkipList<K, V> {
|
|
16
19
|
/**
|
|
17
20
|
* The constructor function initializes a SkipLinkedList object with optional options and elements.
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { Comparator, ElementCallback, PriorityQueueOptions } from '../../types';
|
|
9
9
|
import { PriorityQueue } from './priority-queue';
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
10
13
|
export declare class MaxPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
|
|
11
14
|
/**
|
|
12
15
|
* The constructor initializes a PriorityQueue with optional elements and options, including a
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MaxPriorityQueue = void 0;
|
|
4
4
|
const priority_queue_1 = require("./priority-queue");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
5
8
|
class MaxPriorityQueue extends priority_queue_1.PriorityQueue {
|
|
6
9
|
/**
|
|
7
10
|
* The constructor initializes a PriorityQueue with optional elements and options, including a
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { Comparator, ElementCallback, PriorityQueueOptions } from '../../types';
|
|
9
9
|
import { PriorityQueue } from './priority-queue';
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
10
13
|
export declare class MinPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
|
|
11
14
|
/**
|
|
12
15
|
* The constructor initializes a PriorityQueue with optional elements and options, including a
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MinPriorityQueue = void 0;
|
|
4
4
|
const priority_queue_1 = require("./priority-queue");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
5
8
|
class MinPriorityQueue extends priority_queue_1.PriorityQueue {
|
|
6
9
|
/**
|
|
7
10
|
* The constructor initializes a PriorityQueue with optional elements and options, including a
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ElementCallback, TrieOptions } from '../../types';
|
|
9
9
|
import { IterableElementBase } from '../base';
|
|
10
|
-
/**
|
|
11
|
-
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
12
|
-
* and a flag indicating whether it's the end of a word.
|
|
13
|
-
*/
|
|
14
10
|
export declare class TrieNode {
|
|
15
11
|
constructor(key: string);
|
|
16
12
|
protected _key: string;
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Trie = exports.TrieNode = void 0;
|
|
4
4
|
const base_1 = require("../base");
|
|
5
|
-
/**
|
|
6
|
-
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
7
|
-
* and a flag indicating whether it's the end of a word.
|
|
8
|
-
*/
|
|
9
5
|
class TrieNode {
|
|
10
6
|
constructor(key) {
|
|
11
7
|
this._key = key;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BinaryTreeDeleteResult,
|
|
3
|
-
export interface IBinaryTree<K = any, V = any, R = object,
|
|
4
|
-
createNode(key: K, value?:
|
|
5
|
-
createTree(options?: Partial<BinaryTreeOptions<K, V, R>>):
|
|
6
|
-
add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V,
|
|
7
|
-
addMany(nodes: Iterable<BTNRep<K, V,
|
|
8
|
-
delete(predicate: R | BTNRep<K, V,
|
|
1
|
+
import { BinaryTreeNode } from '../data-structures';
|
|
2
|
+
import type { BinaryTreeDeleteResult, BinaryTreeOptions, BTNRep, NodePredicate } from '../types';
|
|
3
|
+
export interface IBinaryTree<K = any, V = any, R = object, MK = any, MV = any, MR = object> {
|
|
4
|
+
createNode(key: K, value?: BinaryTreeNode['value']): BinaryTreeNode;
|
|
5
|
+
createTree(options?: Partial<BinaryTreeOptions<K, V, R>>): IBinaryTree<K, V, R, MK, MV, MR>;
|
|
6
|
+
add(keyOrNodeOrEntryOrRawElement: BTNRep<K, V, BinaryTreeNode<K, V>>, value?: V, count?: number): boolean;
|
|
7
|
+
addMany(nodes: Iterable<BTNRep<K, V, BinaryTreeNode<K, V>>>, values?: Iterable<V | undefined>): boolean[];
|
|
8
|
+
delete(predicate: R | BTNRep<K, V, BinaryTreeNode<K, V>> | NodePredicate<BinaryTreeNode<K, V>>): BinaryTreeDeleteResult<BinaryTreeNode<K, V>>[];
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IterableElementBase, IterableEntryBase } from '../../../data-structures';
|
|
2
|
-
export type EntryCallback<K, V, R> = (
|
|
2
|
+
export type EntryCallback<K, V, R> = (key: K, value: V, index: number, container: IterableEntryBase<K, V>) => R;
|
|
3
3
|
export type ElementCallback<E, R, RT, C> = (element: E, index: number, container: IterableElementBase<E, R, C>) => RT;
|
|
4
4
|
export type ReduceEntryCallback<K, V, R> = (accumulator: R, value: V, key: K, index: number, container: IterableEntryBase<K, V>) => R;
|
|
5
5
|
export type ReduceElementCallback<E, R, RT, C> = (accumulator: RT, element: E, index: number, container: IterableElementBase<E, R, C>) => RT;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { AVLTreeMultiMap, AVLTreeMultiMapNode } from '../../../data-structures';
|
|
2
1
|
import type { AVLTreeOptions } from './avl-tree';
|
|
3
|
-
export type
|
|
4
|
-
export type AVLTreeMultiMapNested<K, V, R, NODE extends AVLTreeMultiMapNode<K, V, NODE>> = AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, AVLTreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
|
-
export type AVLTreeMultiMapOptions<K, V, R> = AVLTreeOptions<K, V, R> & {};
|
|
2
|
+
export type AVLTreeMultiMapOptions<K, V, R> = Omit<AVLTreeOptions<K, V, R>, 'isMapMode'> & {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { AVLTree, AVLTreeNode } from '../../../data-structures';
|
|
2
1
|
import { BSTOptions } from './bst';
|
|
3
|
-
export type AVLTreeNodeNested<K, V> = AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, AVLTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
|
-
export type AVLTreeNested<K, V, R, NODE extends AVLTreeNode<K, V, NODE>> = AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, AVLTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
2
|
export type AVLTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { BinaryTree, BinaryTreeNode } from '../../../data-structures';
|
|
2
1
|
import { IterationType, OptValue } from '../../common';
|
|
3
2
|
import { DFSOperation } from '../../../common';
|
|
4
|
-
export type BinaryTreeNodeNested<K, V> = BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, BinaryTreeNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
|
-
export type BinaryTreeNested<K, V, R, NODE extends BinaryTreeNode<K, V, NODE>> = BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, BinaryTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
6
3
|
export type ToEntryFn<K, V, R> = (rawElement: R) => BTNEntry<K, V>;
|
|
7
4
|
export type BinaryTreeOptions<K, V, R> = {
|
|
8
5
|
iterationType?: IterationType;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BST, BSTNode } from '../../../data-structures';
|
|
2
1
|
import type { BinaryTreeOptions } from './binary-tree';
|
|
3
2
|
import { Comparable } from '../../utils';
|
|
4
|
-
|
|
5
|
-
export type BSTNested<K, V, R, NODE extends BSTNode<K, V, NODE>> = BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, BST<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
3
|
+
import { OptValue } from '../../common';
|
|
6
4
|
export type BSTOptions<K, V, R> = BinaryTreeOptions<K, V, R> & {
|
|
7
|
-
|
|
5
|
+
specifyComparable?: (key: K) => Comparable;
|
|
8
6
|
isReverse?: boolean;
|
|
9
7
|
};
|
|
10
8
|
export type BSTNOptKey<K> = K | undefined;
|
|
11
9
|
export type OptNode<NODE> = NODE | undefined;
|
|
10
|
+
export type BSTNEntry<K, V> = [BSTNOptKey<K>, OptValue<V>];
|
|
12
11
|
export type BSTNOptKeyOrNode<K, NODE> = BSTNOptKey<K> | NODE;
|
|
12
|
+
export type BSTNRep<K, V, NODE> = BSTNEntry<K, V> | BSTNOptKeyOrNode<K, NODE>;
|
|
@@ -21,3 +21,5 @@ __exportStar(require("./segment-tree"), exports);
|
|
|
21
21
|
__exportStar(require("./avl-tree-multi-map"), exports);
|
|
22
22
|
__exportStar(require("./rb-tree"), exports);
|
|
23
23
|
__exportStar(require("./tree-multi-map"), exports);
|
|
24
|
+
__exportStar(require("./tree-counter"), exports);
|
|
25
|
+
__exportStar(require("./avl-tree-counter"), exports);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BSTOptions } from "./bst";
|
|
1
|
+
import type { BSTOptions } from './bst';
|
|
3
2
|
export type RBTNColor = 'RED' | 'BLACK';
|
|
4
|
-
export type
|
|
5
|
-
export type RedBlackTreeNested<K, V, R, NODE extends RedBlackTreeNode<K, V, NODE>> = RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, RedBlackTree<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
6
|
-
export type RBTreeOptions<K, V, R> = Omit<BSTOptions<K, V, R>, 'isReverse'> & {};
|
|
3
|
+
export type RedBlackTreeOptions<K, V, R> = BSTOptions<K, V, R> & {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type TreeMultiMapNodeNested<K, V> = TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, TreeMultiMapNode<K, V, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
4
|
-
export type TreeMultiMapNested<K, V, R, NODE extends TreeMultiMapNode<K, V, NODE>> = TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, TreeMultiMap<K, V, R, NODE, any>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
|
|
5
|
-
export type TreeMultiMapOptions<K, V, R> = RBTreeOptions<K, V, R> & {};
|
|
1
|
+
import type { RedBlackTreeOptions } from './rb-tree';
|
|
2
|
+
export type TreeMultiMapOptions<K, V, R> = Omit<RedBlackTreeOptions<K, V, R>, 'isMapMode'> & {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "binary-tree-typed",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.54.1",
|
|
4
4
|
"description": "Binary Tree. Javascript & Typescript Data Structure.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -140,6 +140,6 @@
|
|
|
140
140
|
"typescript": "^4.9.5"
|
|
141
141
|
},
|
|
142
142
|
"dependencies": {
|
|
143
|
-
"data-structure-typed": "^1.
|
|
143
|
+
"data-structure-typed": "^1.54.1"
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -70,7 +70,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
70
70
|
every(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean {
|
|
71
71
|
let index = 0;
|
|
72
72
|
for (const item of this) {
|
|
73
|
-
if (!predicate.call(thisArg, item[
|
|
73
|
+
if (!predicate.call(thisArg, item[0], item[1], index++, this)) {
|
|
74
74
|
return false;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -95,7 +95,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
95
95
|
some(predicate: EntryCallback<K, V, boolean>, thisArg?: any): boolean {
|
|
96
96
|
let index = 0;
|
|
97
97
|
for (const item of this) {
|
|
98
|
-
if (predicate.call(thisArg, item[
|
|
98
|
+
if (predicate.call(thisArg, item[0], item[1], index++, this)) {
|
|
99
99
|
return true;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -119,7 +119,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
119
119
|
let index = 0;
|
|
120
120
|
for (const item of this) {
|
|
121
121
|
const [key, value] = item;
|
|
122
|
-
callbackfn.call(thisArg,
|
|
122
|
+
callbackfn.call(thisArg, key, value, index++, this);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -144,7 +144,7 @@ export abstract class IterableEntryBase<K = any, V = any> {
|
|
|
144
144
|
let index = 0;
|
|
145
145
|
for (const item of this) {
|
|
146
146
|
const [key, value] = item;
|
|
147
|
-
if (callbackfn.call(thisArg,
|
|
147
|
+
if (callbackfn.call(thisArg, key, value, index++, this)) return item;
|
|
148
148
|
}
|
|
149
149
|
return;
|
|
150
150
|
}
|