directed-graph-typed 1.54.3 → 2.0.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/iterable-element-base.d.ts +14 -40
- package/dist/data-structures/base/iterable-element-base.js +14 -11
- package/dist/data-structures/base/linear-base.d.ts +277 -0
- package/dist/data-structures/base/linear-base.js +552 -0
- package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +12 -8
- package/dist/data-structures/binary-tree/avl-tree-multi-map.js +50 -37
- package/dist/data-structures/binary-tree/avl-tree.d.ts +64 -0
- package/dist/data-structures/binary-tree/avl-tree.js +64 -0
- package/dist/data-structures/binary-tree/binary-tree.js +5 -5
- package/dist/data-structures/binary-tree/bst.js +11 -11
- package/dist/data-structures/binary-tree/tree-multi-map.d.ts +175 -14
- package/dist/data-structures/binary-tree/tree-multi-map.js +210 -40
- package/dist/data-structures/graph/abstract-graph.js +2 -2
- package/dist/data-structures/heap/heap.d.ts +3 -11
- package/dist/data-structures/heap/heap.js +0 -10
- package/dist/data-structures/heap/max-heap.d.ts +2 -2
- package/dist/data-structures/heap/min-heap.d.ts +2 -2
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +65 -94
- package/dist/data-structures/linked-list/doubly-linked-list.js +131 -146
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +79 -75
- package/dist/data-structures/linked-list/singly-linked-list.js +217 -169
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +2 -2
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +2 -2
- package/dist/data-structures/priority-queue/priority-queue.d.ts +2 -2
- package/dist/data-structures/queue/deque.d.ts +130 -91
- package/dist/data-structures/queue/deque.js +269 -169
- package/dist/data-structures/queue/queue.d.ts +84 -40
- package/dist/data-structures/queue/queue.js +134 -50
- package/dist/data-structures/stack/stack.d.ts +3 -11
- package/dist/data-structures/stack/stack.js +0 -10
- package/dist/data-structures/trie/trie.d.ts +4 -3
- package/dist/data-structures/trie/trie.js +3 -0
- package/dist/types/data-structures/base/base.d.ts +9 -4
- package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1 -1
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -2
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +2 -2
- package/dist/types/data-structures/queue/deque.d.ts +2 -3
- package/dist/types/data-structures/queue/queue.d.ts +2 -2
- package/package.json +2 -2
- package/src/data-structures/base/iterable-element-base.ts +29 -20
- package/src/data-structures/base/linear-base.ts +649 -0
- package/src/data-structures/binary-tree/avl-tree-multi-map.ts +51 -36
- package/src/data-structures/binary-tree/avl-tree.ts +64 -0
- package/src/data-structures/binary-tree/binary-tree.ts +5 -5
- package/src/data-structures/binary-tree/bst.ts +9 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +214 -40
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/heap/heap.ts +3 -14
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/heap/min-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +144 -160
- package/src/data-structures/linked-list/singly-linked-list.ts +241 -185
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -5
- package/src/data-structures/priority-queue/min-priority-queue.ts +2 -5
- package/src/data-structures/priority-queue/priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +286 -183
- package/src/data-structures/queue/queue.ts +149 -63
- package/src/data-structures/stack/stack.ts +3 -18
- package/src/data-structures/trie/trie.ts +7 -3
- package/src/types/data-structures/base/base.ts +17 -8
- package/src/types/data-structures/binary-tree/avl-tree-multi-map.ts +1 -1
- package/src/types/data-structures/binary-tree/tree-multi-map.ts +1 -1
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +2 -2
- package/src/types/data-structures/linked-list/singly-linked-list.ts +2 -2
- package/src/types/data-structures/queue/deque.ts +2 -3
- package/src/types/data-structures/queue/queue.ts +2 -2
|
@@ -6,59 +6,27 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import type { DoublyLinkedListOptions, ElementCallback } from '../../types';
|
|
9
|
-
import {
|
|
10
|
-
export declare class DoublyLinkedListNode<E = any> {
|
|
9
|
+
import { LinearLinkedBase, LinkedListNode } from '../base/linear-base';
|
|
10
|
+
export declare class DoublyLinkedListNode<E = any> extends LinkedListNode<E> {
|
|
11
11
|
/**
|
|
12
12
|
* The constructor function initializes the value, next, and previous properties of an object.
|
|
13
13
|
* @param {E} value - The "value" parameter is the value that will be stored in the node. It can be of any data type, as it
|
|
14
14
|
* is defined as a generic type "E".
|
|
15
15
|
*/
|
|
16
16
|
constructor(value: E);
|
|
17
|
-
protected _value: E;
|
|
18
|
-
/**
|
|
19
|
-
* The function returns the value of a protected variable.
|
|
20
|
-
* @returns The value of the variable `_value` is being returned.
|
|
21
|
-
*/
|
|
22
|
-
get value(): E;
|
|
23
|
-
/**
|
|
24
|
-
* The above function sets the value of a variable.
|
|
25
|
-
* @param {E} value - The parameter "value" is of type E, which means it can be any type.
|
|
26
|
-
*/
|
|
27
|
-
set value(value: E);
|
|
28
17
|
protected _next: DoublyLinkedListNode<E> | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* The "next" function returns the next node in a doubly linked list.
|
|
31
|
-
* @returns The `next` property is being returned. It can be either a `DoublyLinkedListNode<E>`
|
|
32
|
-
* object or `undefined`.
|
|
33
|
-
*/
|
|
34
18
|
get next(): DoublyLinkedListNode<E> | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* The "next" property of a DoublyLinkedListNode is set to the provided value.
|
|
37
|
-
* @param {DoublyLinkedListNode<E> | undefined} value - The `value` parameter is of type
|
|
38
|
-
* `DoublyLinkedListNode<E> | undefined`. This means that it can accept either a
|
|
39
|
-
* `DoublyLinkedListNode` object or `undefined` as its value.
|
|
40
|
-
*/
|
|
41
19
|
set next(value: DoublyLinkedListNode<E> | undefined);
|
|
42
20
|
protected _prev: DoublyLinkedListNode<E> | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* The `prev` function returns the previous node in a doubly linked list.
|
|
45
|
-
* @returns The `prev` property of the `DoublyLinkedListNode` class is being returned. It can either
|
|
46
|
-
* be a `DoublyLinkedListNode` object or `undefined`.
|
|
47
|
-
*/
|
|
48
21
|
get prev(): DoublyLinkedListNode<E> | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* The function sets the previous node of a doubly linked list node.
|
|
51
|
-
* @param {DoublyLinkedListNode<E> | undefined} value - The `value` parameter is of type
|
|
52
|
-
* `DoublyLinkedListNode<E> | undefined`. This means that it can accept either a
|
|
53
|
-
* `DoublyLinkedListNode` object or `undefined` as its value.
|
|
54
|
-
*/
|
|
55
22
|
set prev(value: DoublyLinkedListNode<E> | undefined);
|
|
56
23
|
}
|
|
57
24
|
/**
|
|
58
|
-
*1. Node Structure: Each node contains three parts: a data field, a pointer (or reference) to the previous node, and a pointer to the next node. This structure allows traversal of the linked list in both directions.
|
|
25
|
+
* 1. Node Structure: Each node contains three parts: a data field, a pointer (or reference) to the previous node, and a pointer to the next node. This structure allows traversal of the linked list in both directions.
|
|
59
26
|
* 2. Bidirectional Traversal: Unlike singly linked lists, doubly linked lists can be easily traversed forwards or backwards. This makes insertions and deletions in the list more flexible and efficient.
|
|
60
27
|
* 3. No Centralized Index: Unlike arrays, elements in a linked list are not stored contiguously, so there is no centralized index. Accessing elements in a linked list typically requires traversing from the head or tail node.
|
|
61
28
|
* 4. High Efficiency in Insertion and Deletion: Adding or removing elements in a linked list does not require moving other elements, making these operations more efficient than in arrays.
|
|
29
|
+
* Caution: Although our linked list classes provide methods such as at, setAt, addAt, and indexOf that are based on array indices, their time complexity, like that of the native Array.lastIndexOf, is 𝑂(𝑛). If you need to use these methods frequently, you might want to consider other data structures, such as Deque or Queue (designed for random access). Similarly, since the native Array.shift method has a time complexity of 𝑂(𝑛), using an array to simulate a queue can be inefficient. In such cases, you should use Queue or Deque, as these data structures leverage deferred array rearrangement, effectively reducing the average time complexity to 𝑂(1).
|
|
62
30
|
* @example
|
|
63
31
|
* // text editor operation history
|
|
64
32
|
* const actions = [
|
|
@@ -132,7 +100,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
132
100
|
* const initialNode = this.currentSong;
|
|
133
101
|
*
|
|
134
102
|
* // Loop through the playlist twice
|
|
135
|
-
* for (let i = 0; i < this.playlist.
|
|
103
|
+
* for (let i = 0; i < this.playlist.length * 2; i++) {
|
|
136
104
|
* playedSongs.push(this.currentSong!.value);
|
|
137
105
|
* this.currentSong = this.currentSong!.next || this.playlist.head; // Loop back to the start if needed
|
|
138
106
|
* }
|
|
@@ -253,7 +221,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
253
221
|
* }
|
|
254
222
|
*
|
|
255
223
|
* // Check capacity
|
|
256
|
-
* if (this.list.
|
|
224
|
+
* if (this.list.length >= this.capacity) {
|
|
257
225
|
* // Delete the least recently used element (the tail of the linked list)
|
|
258
226
|
* const removedNode = this.list.tail;
|
|
259
227
|
* if (removedNode) {
|
|
@@ -298,9 +266,9 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
298
266
|
* this.map.clear();
|
|
299
267
|
* }
|
|
300
268
|
*
|
|
301
|
-
* // Get the current cache
|
|
302
|
-
* get
|
|
303
|
-
* return this.list.
|
|
269
|
+
* // Get the current cache length
|
|
270
|
+
* get length(): number {
|
|
271
|
+
* return this.list.length;
|
|
304
272
|
* }
|
|
305
273
|
*
|
|
306
274
|
* // Check if it is empty
|
|
@@ -359,7 +327,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
359
327
|
*
|
|
360
328
|
* console.log(cache.delete('a')); // true
|
|
361
329
|
* console.log(cache.get('a')); // undefined
|
|
362
|
-
* console.log(cache.
|
|
330
|
+
* console.log(cache.length); // 1
|
|
363
331
|
*
|
|
364
332
|
* // Should support clearing cache
|
|
365
333
|
* cache.clear();
|
|
@@ -367,7 +335,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
367
335
|
* cache.set('b', 2);
|
|
368
336
|
* cache.clear();
|
|
369
337
|
*
|
|
370
|
-
* console.log(cache.
|
|
338
|
+
* console.log(cache.length); // 0
|
|
371
339
|
* console.log(cache.isEmpty); // true
|
|
372
340
|
* @example
|
|
373
341
|
* // finding lyrics by timestamp in Coldplay's "Fix You"
|
|
@@ -486,7 +454,7 @@ export declare class DoublyLinkedListNode<E = any> {
|
|
|
486
454
|
* scheduler.clear();
|
|
487
455
|
* console.log(scheduler.listProcesses()); // []
|
|
488
456
|
*/
|
|
489
|
-
export declare class DoublyLinkedList<E = any, R = any> extends
|
|
457
|
+
export declare class DoublyLinkedList<E = any, R = any> extends LinearLinkedBase<E, R, DoublyLinkedListNode<E>> {
|
|
490
458
|
/**
|
|
491
459
|
* This TypeScript constructor initializes a DoublyLinkedList with optional elements and options.
|
|
492
460
|
* @param {Iterable<E> | Iterable<R>} elements - The `elements` parameter in the constructor is an
|
|
@@ -499,24 +467,11 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
499
467
|
*/
|
|
500
468
|
constructor(elements?: Iterable<E> | Iterable<R> | Iterable<DoublyLinkedListNode<E>>, options?: DoublyLinkedListOptions<E, R>);
|
|
501
469
|
protected _head: DoublyLinkedListNode<E> | undefined;
|
|
502
|
-
/**
|
|
503
|
-
* The `head` function returns the first node of a doubly linked list.
|
|
504
|
-
* @returns The method `getHead()` returns either a `DoublyLinkedListNode<E>` object or `undefined`.
|
|
505
|
-
*/
|
|
506
470
|
get head(): DoublyLinkedListNode<E> | undefined;
|
|
507
471
|
protected _tail: DoublyLinkedListNode<E> | undefined;
|
|
508
|
-
/**
|
|
509
|
-
* The `tail` function returns the last node of a doubly linked list.
|
|
510
|
-
* @returns The `get tail()` method is returning either a `DoublyLinkedListNode<E>` object or
|
|
511
|
-
* `undefined`.
|
|
512
|
-
*/
|
|
513
472
|
get tail(): DoublyLinkedListNode<E> | undefined;
|
|
514
|
-
protected
|
|
515
|
-
|
|
516
|
-
* The function returns the size of an object.
|
|
517
|
-
* @returns The size of the object, which is a number.
|
|
518
|
-
*/
|
|
519
|
-
get size(): number;
|
|
473
|
+
protected _length: number;
|
|
474
|
+
get length(): number;
|
|
520
475
|
/**
|
|
521
476
|
* Time Complexity: O(1)
|
|
522
477
|
* Space Complexity: O(1)
|
|
@@ -678,7 +633,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
678
633
|
* `addAt` method can be either a value of type `E` or a `DoublyLinkedListNode<E>` object.
|
|
679
634
|
* @returns The `addAt` method returns a boolean value. It returns `true` if the element or node was
|
|
680
635
|
* successfully added at the specified index, and `false` if the index is out of bounds (less than 0
|
|
681
|
-
* or greater than the
|
|
636
|
+
* or greater than the length of the list).
|
|
682
637
|
*/
|
|
683
638
|
addAt(index: number, newElementOrNode: E | DoublyLinkedListNode<E>): boolean;
|
|
684
639
|
/**
|
|
@@ -714,6 +669,20 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
714
669
|
* was not found in the linked list.
|
|
715
670
|
*/
|
|
716
671
|
addAfter(existingElementOrNode: E | DoublyLinkedListNode<E>, newElementOrNode: E | DoublyLinkedListNode<E>): boolean;
|
|
672
|
+
/**
|
|
673
|
+
* Time Complexity: O(n)
|
|
674
|
+
* Space Complexity: O(1)
|
|
675
|
+
*
|
|
676
|
+
* The function `setAt` updates the value at a specified index in a data structure if the index
|
|
677
|
+
* exists.
|
|
678
|
+
* @param {number} index - The `index` parameter in the `setAt` method refers to the position in the
|
|
679
|
+
* data structure where you want to set a new value.
|
|
680
|
+
* @param {E} value - The `value` parameter in the `setAt` method represents the new value that you
|
|
681
|
+
* want to set at the specified index in the data structure.
|
|
682
|
+
* @returns The `setAt` method returns a boolean value - `true` if the value at the specified index
|
|
683
|
+
* is successfully updated, and `false` if the index is out of bounds.
|
|
684
|
+
*/
|
|
685
|
+
setAt(index: number, value: E): boolean;
|
|
717
686
|
/**
|
|
718
687
|
* Time Complexity: O(n)
|
|
719
688
|
* Space Complexity: O(1)
|
|
@@ -724,7 +693,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
724
693
|
* @returns The method `deleteAt` returns the value of the node that was deleted, or `undefined` if the index is out of
|
|
725
694
|
* bounds.
|
|
726
695
|
*/
|
|
727
|
-
deleteAt(index: number):
|
|
696
|
+
deleteAt(index: number): E | undefined;
|
|
728
697
|
/**
|
|
729
698
|
* Time Complexity: O(1) or O(n)
|
|
730
699
|
* Space Complexity: O(1)
|
|
@@ -743,7 +712,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
743
712
|
* Time Complexity: O(1)
|
|
744
713
|
* Space Complexity: O(1)
|
|
745
714
|
*
|
|
746
|
-
* The function checks if a variable has a
|
|
715
|
+
* The function checks if a variable has a length greater than zero and returns a boolean value.
|
|
747
716
|
* @returns A boolean value is being returned.
|
|
748
717
|
*/
|
|
749
718
|
isEmpty(): boolean;
|
|
@@ -751,21 +720,9 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
751
720
|
* Time Complexity: O(1)
|
|
752
721
|
* Space Complexity: O(1)
|
|
753
722
|
*
|
|
754
|
-
* The `clear` function resets the linked list by setting the head, tail, and
|
|
723
|
+
* The `clear` function resets the linked list by setting the head, tail, and length to undefined and 0 respectively.
|
|
755
724
|
*/
|
|
756
725
|
clear(): void;
|
|
757
|
-
/**
|
|
758
|
-
* Time Complexity: O(n)
|
|
759
|
-
* Space Complexity: O(1)
|
|
760
|
-
*
|
|
761
|
-
* This function finds the index of a specified element, node, or predicate in a doubly linked list.
|
|
762
|
-
* @param {E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)} elementNodeOrPredicate
|
|
763
|
-
* elementNodeOrPredicate - The `indexOf` method takes in a parameter `elementNodeOrPredicate`, which
|
|
764
|
-
* can be one of the following:
|
|
765
|
-
* @returns The `indexOf` method returns the index of the element in the doubly linked list that
|
|
766
|
-
* matches the provided element, node, or predicate. If no match is found, it returns -1.
|
|
767
|
-
*/
|
|
768
|
-
indexOf(elementNodeOrPredicate: E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)): number;
|
|
769
726
|
/**
|
|
770
727
|
* Time Complexity: O(n)
|
|
771
728
|
* Space Complexity: O(1)
|
|
@@ -800,22 +757,6 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
800
757
|
* The `reverse` function reverses the order of the elements in a doubly linked list.
|
|
801
758
|
*/
|
|
802
759
|
reverse(): this;
|
|
803
|
-
/**
|
|
804
|
-
* Time Complexity: O(n)
|
|
805
|
-
* Space Complexity: O(n)
|
|
806
|
-
*
|
|
807
|
-
* The `toArray` function converts a linked list into an array.
|
|
808
|
-
* @returns The `toArray()` method is returning an array of type `E[]`.
|
|
809
|
-
*/
|
|
810
|
-
toArray(): E[];
|
|
811
|
-
/**
|
|
812
|
-
* Time Complexity: O(n)
|
|
813
|
-
* Space Complexity: O(n)
|
|
814
|
-
*
|
|
815
|
-
* The `toReversedArray` function converts a doubly linked list into an array in reverse order.
|
|
816
|
-
* @returns The `toReversedArray()` function returns an array of type `E[]`.
|
|
817
|
-
*/
|
|
818
|
-
toReversedArray(): E[];
|
|
819
760
|
/**
|
|
820
761
|
* Time Complexity: O(n)
|
|
821
762
|
* Space Complexity: O(n)
|
|
@@ -825,7 +766,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
825
766
|
* @returns The `clone()` method is returning a new instance of the `DoublyLinkedList` class, which
|
|
826
767
|
* is a copy of the original list.
|
|
827
768
|
*/
|
|
828
|
-
clone():
|
|
769
|
+
clone(): this;
|
|
829
770
|
/**
|
|
830
771
|
* Time Complexity: O(n)
|
|
831
772
|
* Space Complexity: O(n)
|
|
@@ -843,7 +784,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
843
784
|
* @returns The `filter` method is returning a new `DoublyLinkedList` object that contains the
|
|
844
785
|
* elements that pass the filter condition specified by the `callback` function.
|
|
845
786
|
*/
|
|
846
|
-
filter(callback: ElementCallback<E, R, boolean
|
|
787
|
+
filter(callback: ElementCallback<E, R, boolean>, thisArg?: any): DoublyLinkedList<E, R>;
|
|
847
788
|
/**
|
|
848
789
|
* Time Complexity: O(n)
|
|
849
790
|
* Space Complexity: O(n)
|
|
@@ -864,7 +805,7 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
864
805
|
* value of
|
|
865
806
|
* @returns a new instance of the `DoublyLinkedList` class with elements of type `T` and `RR`.
|
|
866
807
|
*/
|
|
867
|
-
map<EM, RM>(callback: ElementCallback<E, R, EM
|
|
808
|
+
map<EM, RM>(callback: ElementCallback<E, R, EM>, toElementFn?: (rawElement: RM) => EM, thisArg?: any): DoublyLinkedList<EM, RM>;
|
|
868
809
|
/**
|
|
869
810
|
* Time Complexity: O(n)
|
|
870
811
|
* Space Complexity: O(1)
|
|
@@ -881,6 +822,16 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
881
822
|
* The function returns an iterator that iterates over the values of a linked list.
|
|
882
823
|
*/
|
|
883
824
|
protected _getIterator(): IterableIterator<E>;
|
|
825
|
+
/**
|
|
826
|
+
* The function returns an iterator that iterates over the elements of a data structure in reverse
|
|
827
|
+
* order.
|
|
828
|
+
*/
|
|
829
|
+
protected _getReverseIterator(): IterableIterator<E>;
|
|
830
|
+
/**
|
|
831
|
+
* The function returns an iterator that iterates over the nodes of a doubly linked list starting
|
|
832
|
+
* from the head.
|
|
833
|
+
*/
|
|
834
|
+
protected _getNodeIterator(): IterableIterator<DoublyLinkedListNode<E>>;
|
|
884
835
|
/**
|
|
885
836
|
* The function `_isPredicate` checks if the input is a function that takes a `DoublyLinkedListNode`
|
|
886
837
|
* as an argument and returns a boolean.
|
|
@@ -911,4 +862,24 @@ export declare class DoublyLinkedList<E = any, R = any> extends IterableElementB
|
|
|
911
862
|
* returns a boolean value based on the conditions specified in the code.
|
|
912
863
|
*/
|
|
913
864
|
protected _ensurePredicate(elementNodeOrPredicate: E | DoublyLinkedListNode<E> | ((node: DoublyLinkedListNode<E>) => boolean)): (node: DoublyLinkedListNode<E>) => boolean;
|
|
865
|
+
/**
|
|
866
|
+
* The function `_createInstance` returns a new instance of `DoublyLinkedList` with the specified
|
|
867
|
+
* options.
|
|
868
|
+
* @param [options] - The `options` parameter in the `_createInstance` method is of type
|
|
869
|
+
* `DoublyLinkedListOptions<E, R>`. It is an optional parameter that allows you to pass additional
|
|
870
|
+
* configuration options when creating a new instance of the `DoublyLinkedList` class.
|
|
871
|
+
* @returns An instance of the `DoublyLinkedList` class with an empty array and the provided options
|
|
872
|
+
* is being returned, cast as the current class type.
|
|
873
|
+
*/
|
|
874
|
+
protected _createInstance(options?: DoublyLinkedListOptions<E, R>): this;
|
|
875
|
+
/**
|
|
876
|
+
* The function `_getPrevNode` returns the previous node of a given node in a doubly linked list.
|
|
877
|
+
* @param node - The parameter `node` in the `_getPrevNode` method is of type
|
|
878
|
+
* `DoublyLinkedListNode<E>`, which represents a node in a doubly linked list containing an element
|
|
879
|
+
* of type `E`.
|
|
880
|
+
* @returns The `_getPrevNode` method is returning the previous node of the input `node` in a doubly
|
|
881
|
+
* linked list. If the input node has a previous node, it will return that node. Otherwise, it will
|
|
882
|
+
* return `undefined`.
|
|
883
|
+
*/
|
|
884
|
+
protected _getPrevNode(node: DoublyLinkedListNode<E>): DoublyLinkedListNode<E> | undefined;
|
|
914
885
|
}
|