min-heap-typed 1.51.9 → 1.52.0
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/index.d.ts +2 -1
- package/dist/data-structures/base/index.js +2 -1
- package/dist/data-structures/base/iterable-element-base.d.ts +171 -0
- package/dist/data-structures/base/iterable-element-base.js +225 -0
- package/dist/data-structures/base/{iterable-base.d.ts → iterable-entry-base.d.ts} +4 -147
- package/dist/data-structures/base/{iterable-base.js → iterable-entry-base.js} +12 -189
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +3 -3
- package/dist/data-structures/binary-tree/avl-tree.d.ts +3 -3
- package/dist/data-structures/binary-tree/binary-tree.d.ts +4 -4
- package/dist/data-structures/binary-tree/binary-tree.js +5 -3
- package/dist/data-structures/binary-tree/bst.d.ts +3 -11
- package/dist/data-structures/binary-tree/bst.js +2 -10
- package/dist/data-structures/binary-tree/rb-tree.d.ts +3 -3
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +3 -3
- package/dist/data-structures/hash/hash-map.d.ts +2 -2
- package/dist/data-structures/heap/heap.d.ts +43 -114
- package/dist/data-structures/heap/heap.js +59 -127
- package/dist/data-structures/heap/max-heap.d.ts +50 -4
- package/dist/data-structures/heap/max-heap.js +76 -10
- package/dist/data-structures/heap/min-heap.d.ts +51 -5
- package/dist/data-structures/heap/min-heap.js +68 -11
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +22 -28
- package/dist/data-structures/linked-list/doubly-linked-list.js +26 -28
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +22 -25
- package/dist/data-structures/linked-list/singly-linked-list.js +29 -26
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +50 -4
- package/dist/data-structures/priority-queue/max-priority-queue.js +79 -10
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +51 -5
- package/dist/data-structures/priority-queue/min-priority-queue.js +71 -11
- package/dist/data-structures/priority-queue/priority-queue.d.ts +50 -4
- package/dist/data-structures/priority-queue/priority-queue.js +70 -1
- package/dist/data-structures/queue/deque.d.ts +20 -18
- package/dist/data-structures/queue/deque.js +27 -20
- package/dist/data-structures/queue/queue.d.ts +8 -28
- package/dist/data-structures/queue/queue.js +15 -31
- package/dist/data-structures/stack/stack.d.ts +17 -22
- package/dist/data-structures/stack/stack.js +25 -24
- package/dist/data-structures/trie/trie.d.ts +18 -13
- package/dist/data-structures/trie/trie.js +26 -15
- package/dist/interfaces/binary-tree.d.ts +2 -2
- package/dist/types/data-structures/base/base.d.ts +5 -2
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/bst.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/rb-tree.d.ts +2 -3
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -3
- package/dist/types/data-structures/heap/heap.d.ts +3 -2
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -1
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -1
- package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/types/data-structures/queue/deque.d.ts +3 -2
- package/dist/types/data-structures/queue/queue.d.ts +2 -1
- package/dist/types/data-structures/stack/stack.d.ts +2 -1
- package/dist/types/data-structures/trie/trie.d.ts +3 -2
- package/package.json +2 -2
- package/src/data-structures/base/index.ts +2 -1
- package/src/data-structures/base/iterable-element-base.ts +250 -0
- package/src/data-structures/base/{iterable-base.ts → iterable-entry-base.ts} +22 -213
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +2 -3
- package/src/data-structures/binary-tree/avl-tree.ts +2 -3
- package/src/data-structures/binary-tree/binary-tree.ts +6 -6
- package/src/data-structures/binary-tree/bst.ts +8 -19
- package/src/data-structures/binary-tree/rb-tree.ts +2 -3
- package/src/data-structures/binary-tree/tree-multi-map.ts +2 -3
- package/src/data-structures/hash/hash-map.ts +4 -4
- package/src/data-structures/heap/heap.ts +71 -152
- package/src/data-structures/heap/max-heap.ts +88 -13
- package/src/data-structures/heap/min-heap.ts +78 -15
- package/src/data-structures/linked-list/doubly-linked-list.ts +32 -32
- package/src/data-structures/linked-list/singly-linked-list.ts +37 -29
- package/src/data-structures/priority-queue/max-priority-queue.ts +94 -13
- package/src/data-structures/priority-queue/min-priority-queue.ts +84 -15
- package/src/data-structures/priority-queue/priority-queue.ts +81 -4
- package/src/data-structures/queue/deque.ts +35 -24
- package/src/data-structures/queue/queue.ts +23 -36
- package/src/data-structures/stack/stack.ts +31 -26
- package/src/data-structures/trie/trie.ts +33 -18
- package/src/interfaces/binary-tree.ts +1 -2
- package/src/types/data-structures/base/base.ts +14 -6
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +2 -3
- package/src/types/data-structures/binary-tree/avl-tree.ts +2 -3
- package/src/types/data-structures/binary-tree/binary-tree.ts +3 -4
- package/src/types/data-structures/binary-tree/bst.ts +2 -3
- package/src/types/data-structures/binary-tree/rb-tree.ts +2 -3
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +2 -3
- package/src/types/data-structures/heap/heap.ts +4 -1
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +3 -1
- package/src/types/data-structures/linked-list/singly-linked-list.ts +3 -1
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -1
- package/src/types/data-structures/queue/deque.ts +3 -1
- package/src/types/data-structures/queue/queue.ts +3 -1
- package/src/types/data-structures/stack/stack.ts +3 -1
- package/src/types/data-structures/trie/trie.ts +3 -1
|
@@ -16,30 +16,27 @@ import { IterableElementBase } from '../base';
|
|
|
16
16
|
* 5. Managing Dynamic Data Sets: Heaps effectively manage dynamic data sets, especially when frequent access to the largest or smallest elements is required.
|
|
17
17
|
* 6. Non-linear Search: While a heap allows rapid access to its largest or smallest element, it is less efficient for other operations, such as searching for a specific element, as it is not designed for these tasks.
|
|
18
18
|
* 7. Efficient Sorting Algorithms: For example, heap sort. Heap sort uses the properties of a heap to sort elements.
|
|
19
|
-
* 8. Graph Algorithms: Such as Dijkstra's shortest path algorithm and
|
|
19
|
+
* 8. Graph Algorithms: Such as Dijkstra's shortest path algorithm and Prime's minimum-spanning tree algorithm, which use heaps to improve performance.
|
|
20
20
|
*/
|
|
21
|
-
export declare class Heap<E = any> extends IterableElementBase<E
|
|
21
|
+
export declare class Heap<E = any, R = any> extends IterableElementBase<E, R, Heap<E, R>> {
|
|
22
22
|
/**
|
|
23
23
|
* The constructor initializes a heap data structure with optional elements and options.
|
|
24
24
|
* @param elements - The `elements` parameter is an iterable object that contains the initial
|
|
25
|
-
* elements to be added to the heap.
|
|
25
|
+
* elements to be added to the heap.
|
|
26
|
+
* It is an optional parameter, and if not provided, the heap will
|
|
26
27
|
* be initialized as empty.
|
|
27
28
|
* @param [options] - The `options` parameter is an optional object that can contain additional
|
|
28
|
-
* configuration options for the heap.
|
|
29
|
-
*
|
|
29
|
+
* configuration options for the heap.
|
|
30
|
+
* In this case, it is used to specify a custom comparator
|
|
31
|
+
* function for comparing elements in the heap.
|
|
32
|
+
* The comparator function is used to determine the
|
|
30
33
|
* order of elements in the heap.
|
|
31
34
|
*/
|
|
32
|
-
constructor(elements?: Iterable<E>, options?: HeapOptions<E>);
|
|
33
|
-
protected _comparator: (a: E, b: E) => number;
|
|
34
|
-
/**
|
|
35
|
-
* The function returns the value of the _comparator property.
|
|
36
|
-
* @returns The `_comparator` property is being returned.
|
|
37
|
-
*/
|
|
38
|
-
get comparator(): (a: E, b: E) => number;
|
|
35
|
+
constructor(elements?: Iterable<E> | Iterable<R>, options?: HeapOptions<E, R>);
|
|
39
36
|
protected _elements: E[];
|
|
40
37
|
/**
|
|
41
38
|
* The function returns an array of elements.
|
|
42
|
-
* @returns The
|
|
39
|
+
* @returns The element array is being returned.
|
|
43
40
|
*/
|
|
44
41
|
get elements(): E[];
|
|
45
42
|
/**
|
|
@@ -57,12 +54,7 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
57
54
|
* @param elements
|
|
58
55
|
* @param options
|
|
59
56
|
*/
|
|
60
|
-
static heapify<E>(elements: Iterable<E>, options: HeapOptions<E>): Heap<E>;
|
|
61
|
-
/**
|
|
62
|
-
* Time Complexity: O(log n)
|
|
63
|
-
* Space Complexity: O(1)
|
|
64
|
-
* where n is the number of elements in the heap.
|
|
65
|
-
*/
|
|
57
|
+
static heapify<E = any, R = any>(elements: Iterable<E>, options: HeapOptions<E, R>): Heap<E>;
|
|
66
58
|
/**
|
|
67
59
|
* Time Complexity: O(log n)
|
|
68
60
|
* Space Complexity: O(1)
|
|
@@ -71,23 +63,14 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
71
63
|
* @param element - The element to be inserted.
|
|
72
64
|
*/
|
|
73
65
|
add(element: E): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Time Complexity: O(log n)
|
|
76
|
-
* Space Complexity: O(1)
|
|
77
|
-
* where n is the number of elements in the heap.
|
|
78
|
-
*/
|
|
79
66
|
/**
|
|
80
67
|
* Time Complexity: O(log n)
|
|
81
68
|
* Space Complexity: O(1)
|
|
82
69
|
*
|
|
83
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
70
|
+
* Remove and return the top element (the smallest or largest element) from the heap.
|
|
84
71
|
* @returns The top element or undefined if the heap is empty.
|
|
85
72
|
*/
|
|
86
73
|
poll(): E | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Time Complexity: O(1)
|
|
89
|
-
* Space Complexity: O(1)
|
|
90
|
-
*/
|
|
91
74
|
/**
|
|
92
75
|
* Time Complexity: O(1)
|
|
93
76
|
* Space Complexity: O(1)
|
|
@@ -105,10 +88,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
105
88
|
* Reset the elements of the heap. Make the elements empty.
|
|
106
89
|
*/
|
|
107
90
|
clear(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Time Complexity: O(n)
|
|
110
|
-
* Space Complexity: O(n)
|
|
111
|
-
*/
|
|
112
91
|
/**
|
|
113
92
|
* Time Complexity: O(n)
|
|
114
93
|
* Space Complexity: O(n)
|
|
@@ -117,10 +96,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
117
96
|
* @param elements
|
|
118
97
|
*/
|
|
119
98
|
refill(elements: E[]): boolean[];
|
|
120
|
-
/**
|
|
121
|
-
* Time Complexity: O(n)
|
|
122
|
-
* Space Complexity: O(1)
|
|
123
|
-
*/
|
|
124
99
|
/**
|
|
125
100
|
* Time Complexity: O(n)
|
|
126
101
|
* Space Complexity: O(1)
|
|
@@ -131,12 +106,7 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
131
106
|
*/
|
|
132
107
|
has(element: E): boolean;
|
|
133
108
|
/**
|
|
134
|
-
* Time Complexity:
|
|
135
|
-
* Space Complexity: O(1)
|
|
136
|
-
* The worst-case O(n) This is because, in the worst case, the element to be deleted is located at the end of the heap (not the root), and after deletion, we may need to reorganize the elements by performing a sinkDown operation.
|
|
137
|
-
*/
|
|
138
|
-
/**
|
|
139
|
-
* Time Complexity: O(n)
|
|
109
|
+
* Time Complexity: O(n)
|
|
140
110
|
* Space Complexity: O(1)
|
|
141
111
|
*
|
|
142
112
|
* The `delete` function removes an element from an array-like data structure, maintaining the order
|
|
@@ -147,11 +117,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
147
117
|
* successfully deleted from the array, and `false` if the element was not found in the array.
|
|
148
118
|
*/
|
|
149
119
|
delete(element: E): boolean;
|
|
150
|
-
/**
|
|
151
|
-
* Time Complexity: O(n)
|
|
152
|
-
* Space Complexity: O(log n)
|
|
153
|
-
* where log n is the height of the heap.
|
|
154
|
-
*/
|
|
155
120
|
/**
|
|
156
121
|
* Time Complexity: O(n)
|
|
157
122
|
* Space Complexity: O(log n)
|
|
@@ -161,10 +126,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
161
126
|
* @returns An array containing elements traversed in the specified order.
|
|
162
127
|
*/
|
|
163
128
|
dfs(order?: DFSOrderPattern): E[];
|
|
164
|
-
/**
|
|
165
|
-
* Time Complexity: O(n)
|
|
166
|
-
* Space Complexity: O(n)
|
|
167
|
-
*/
|
|
168
129
|
/**
|
|
169
130
|
* Time Complexity: O(n)
|
|
170
131
|
* Space Complexity: O(n)
|
|
@@ -173,10 +134,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
173
134
|
* @returns An array containing the elements of the heap.
|
|
174
135
|
*/
|
|
175
136
|
toArray(): E[];
|
|
176
|
-
/**
|
|
177
|
-
* Time Complexity: O(n)
|
|
178
|
-
* Space Complexity: O(n)
|
|
179
|
-
*/
|
|
180
137
|
/**
|
|
181
138
|
* Time Complexity: O(n)
|
|
182
139
|
* Space Complexity: O(n)
|
|
@@ -184,11 +141,7 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
184
141
|
* Clone the heap, creating a new heap with the same elements.
|
|
185
142
|
* @returns A new Heap instance containing the same elements.
|
|
186
143
|
*/
|
|
187
|
-
clone(): Heap<E>;
|
|
188
|
-
/**
|
|
189
|
-
* Time Complexity: O(n log n)
|
|
190
|
-
* Space Complexity: O(n)
|
|
191
|
-
*/
|
|
144
|
+
clone(): Heap<E, R>;
|
|
192
145
|
/**
|
|
193
146
|
* Time Complexity: O(n log n)
|
|
194
147
|
* Space Complexity: O(n)
|
|
@@ -197,10 +150,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
197
150
|
* @returns An array containing the elements sorted in ascending order.
|
|
198
151
|
*/
|
|
199
152
|
sort(): E[];
|
|
200
|
-
/**
|
|
201
|
-
* Time Complexity: O(n log n)
|
|
202
|
-
* Space Complexity: O(n)
|
|
203
|
-
*/
|
|
204
153
|
/**
|
|
205
154
|
* Time Complexity: O(n log n)
|
|
206
155
|
* Space Complexity: O(n)
|
|
@@ -208,10 +157,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
208
157
|
* Fix the entire heap to maintain heap properties.
|
|
209
158
|
*/
|
|
210
159
|
fix(): boolean[];
|
|
211
|
-
/**
|
|
212
|
-
* Time Complexity: O(n)
|
|
213
|
-
* Space Complexity: O(n)
|
|
214
|
-
*/
|
|
215
160
|
/**
|
|
216
161
|
* Time Complexity: O(n)
|
|
217
162
|
* Space Complexity: O(n)
|
|
@@ -228,40 +173,40 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
228
173
|
* @returns The `filter` method is returning a new `Heap` object that contains the elements that pass
|
|
229
174
|
* the filter condition specified by the `callback` function.
|
|
230
175
|
*/
|
|
231
|
-
filter(callback: ElementCallback<E, boolean
|
|
232
|
-
/**
|
|
233
|
-
* Time Complexity: O(n)
|
|
234
|
-
* Space Complexity: O(n)
|
|
235
|
-
*/
|
|
176
|
+
filter(callback: ElementCallback<E, R, boolean, Heap<E, R>>, thisArg?: any): Heap<E, R>;
|
|
236
177
|
/**
|
|
237
|
-
* Time Complexity: O(n)
|
|
178
|
+
* Time Complexity: O(n log n)
|
|
238
179
|
* Space Complexity: O(n)
|
|
239
180
|
*
|
|
240
181
|
* The `map` function creates a new heap by applying a callback function to each element of the
|
|
241
182
|
* original heap.
|
|
242
|
-
* @param callback - The callback parameter is a function that will be called for each element in
|
|
243
|
-
*
|
|
244
|
-
* and the
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
183
|
+
* @param callback - The `callback` parameter is a function that will be called for each element in
|
|
184
|
+
* the heap. It takes three arguments: `el` (the current element), `index` (the index of the current
|
|
185
|
+
* element), and `this` (the heap itself). The callback function should return a value of
|
|
186
|
+
* @param comparator - The `comparator` parameter is a function that defines the order of the
|
|
187
|
+
* elements in the heap. It takes two elements `a` and `b` as arguments and returns a negative number
|
|
188
|
+
* if `a` should be placed before `b`, a positive number if `a` should be placed after
|
|
189
|
+
* @param [toElementFn] - The `toElementFn` parameter is an optional function that converts the raw
|
|
190
|
+
* element `RR` to the desired type `T`. It takes a single argument `rawElement` of type `RR` and
|
|
191
|
+
* returns a value of type `T`. This function is used to transform the elements of the original
|
|
249
192
|
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
|
|
250
|
-
* specify the value of `this` within the callback function. It is used
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* @returns a new instance of the Heap class
|
|
254
|
-
* original Heap.
|
|
193
|
+
* specify the value of `this` within the callback function. It is used to set the context or scope
|
|
194
|
+
* in which the callback function will be executed. If `thisArg` is provided, it will be used as the
|
|
195
|
+
* value of
|
|
196
|
+
* @returns a new instance of the `Heap` class with the mapped elements.
|
|
255
197
|
*/
|
|
256
|
-
map<
|
|
198
|
+
map<EM, RM>(callback: ElementCallback<E, R, EM, Heap<E, R>>, comparator: Comparator<EM>, toElementFn?: (rawElement: RM) => EM, thisArg?: any): Heap<EM, RM>;
|
|
199
|
+
protected _DEFAULT_COMPARATOR: (a: E, b: E) => number;
|
|
200
|
+
protected _comparator: Comparator<E>;
|
|
257
201
|
/**
|
|
258
|
-
* The function
|
|
202
|
+
* The function returns the value of the _comparator property.
|
|
203
|
+
* @returns The `_comparator` property is being returned.
|
|
259
204
|
*/
|
|
260
|
-
|
|
205
|
+
get comparator(): Comparator<E>;
|
|
261
206
|
/**
|
|
262
|
-
*
|
|
263
|
-
* Space Complexity: O(1)
|
|
207
|
+
* The function `_getIterator` returns an iterable iterator for the elements in the class.
|
|
264
208
|
*/
|
|
209
|
+
protected _getIterator(): IterableIterator<E>;
|
|
265
210
|
/**
|
|
266
211
|
* Time Complexity: O(log n)
|
|
267
212
|
* Space Complexity: O(1)
|
|
@@ -270,10 +215,6 @@ export declare class Heap<E = any> extends IterableElementBase<E> {
|
|
|
270
215
|
* @param index - The index of the newly added element.
|
|
271
216
|
*/
|
|
272
217
|
protected _bubbleUp(index: number): boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Time Complexity: O(log n)
|
|
275
|
-
* Space Complexity: O(1)
|
|
276
|
-
*/
|
|
277
218
|
/**
|
|
278
219
|
* Time Complexity: O(log n)
|
|
279
220
|
* Space Complexity: O(1)
|
|
@@ -343,10 +284,6 @@ export declare class FibonacciHeap<E> {
|
|
|
343
284
|
* @returns {number} The size of the heap. Returns 0 if the heap is empty. Returns -1 if the heap is invalid.
|
|
344
285
|
*/
|
|
345
286
|
clear(): void;
|
|
346
|
-
/**
|
|
347
|
-
* Time Complexity: O(1)
|
|
348
|
-
* Space Complexity: O(1)
|
|
349
|
-
*/
|
|
350
287
|
/**
|
|
351
288
|
* Time Complexity: O(1)
|
|
352
289
|
* Space Complexity: O(1)
|
|
@@ -356,10 +293,6 @@ export declare class FibonacciHeap<E> {
|
|
|
356
293
|
* @returns {FibonacciHeap<E>} FibonacciHeap<E> - The heap itself.
|
|
357
294
|
*/
|
|
358
295
|
add(element: E): FibonacciHeap<E>;
|
|
359
|
-
/**
|
|
360
|
-
* Time Complexity: O(1)
|
|
361
|
-
* Space Complexity: O(1)
|
|
362
|
-
*/
|
|
363
296
|
/**
|
|
364
297
|
* Time Complexity: O(1)
|
|
365
298
|
* Space Complexity: O(1)
|
|
@@ -369,10 +302,6 @@ export declare class FibonacciHeap<E> {
|
|
|
369
302
|
* @returns {FibonacciHeap<E>} FibonacciHeap<E> - The heap itself.
|
|
370
303
|
*/
|
|
371
304
|
push(element: E): FibonacciHeap<E>;
|
|
372
|
-
/**
|
|
373
|
-
* Time Complexity: O(1)
|
|
374
|
-
* Space Complexity: O(1)
|
|
375
|
-
*/
|
|
376
305
|
/**
|
|
377
306
|
* Time Complexity: O(1)
|
|
378
307
|
* Space Complexity: O(1)
|
|
@@ -412,7 +341,7 @@ export declare class FibonacciHeap<E> {
|
|
|
412
341
|
* Time Complexity: O(log n)
|
|
413
342
|
* Space Complexity: O(1)
|
|
414
343
|
*
|
|
415
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
344
|
+
* Remove and return the top element (the smallest or largest element) from the heap.
|
|
416
345
|
* @returns The top element or undefined if the heap is empty.
|
|
417
346
|
*/
|
|
418
347
|
poll(): E | undefined;
|
|
@@ -424,7 +353,7 @@ export declare class FibonacciHeap<E> {
|
|
|
424
353
|
* Time Complexity: O(log n)
|
|
425
354
|
* Space Complexity: O(1)
|
|
426
355
|
*
|
|
427
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
356
|
+
* Remove and return the top element (the smallest or largest element) from the heap.
|
|
428
357
|
* @returns The top element or undefined if the heap is empty.
|
|
429
358
|
*/
|
|
430
359
|
pop(): E | undefined;
|
|
@@ -472,8 +401,8 @@ export declare class FibonacciHeap<E> {
|
|
|
472
401
|
/**
|
|
473
402
|
* Time Complexity: O(1)
|
|
474
403
|
* Space Complexity: O(1)
|
|
475
|
-
|
|
476
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
404
|
+
*
|
|
405
|
+
* Remove and return the top element (the smallest or largest element) from the heap.
|
|
477
406
|
* @param node - The node to be removed.
|
|
478
407
|
* @protected
|
|
479
408
|
*/
|
|
@@ -486,7 +415,7 @@ export declare class FibonacciHeap<E> {
|
|
|
486
415
|
* Time Complexity: O(1)
|
|
487
416
|
* Space Complexity: O(1)
|
|
488
417
|
*
|
|
489
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
418
|
+
* Remove and return the top element (the smallest or largest element) from the heap.
|
|
490
419
|
* @param y
|
|
491
420
|
* @param x
|
|
492
421
|
* @protected
|
|
@@ -500,7 +429,7 @@ export declare class FibonacciHeap<E> {
|
|
|
500
429
|
* Time Complexity: O(n log n)
|
|
501
430
|
* Space Complexity: O(n)
|
|
502
431
|
*
|
|
503
|
-
* Remove and return the top element (smallest or largest element) from the heap.
|
|
432
|
+
* Remove and return the top element (the smallest or largest element) from the heap.
|
|
504
433
|
* @protected
|
|
505
434
|
*/
|
|
506
435
|
protected _consolidate(): void;
|