min-heap-typed 1.39.6 → 1.40.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.
Files changed (93) hide show
  1. package/dist/data-structures/binary-tree/avl-tree.js +0 -1
  2. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -3
  3. package/dist/data-structures/binary-tree/binary-indexed-tree.js +2 -11
  4. package/dist/data-structures/binary-tree/binary-tree.d.ts +5 -20
  5. package/dist/data-structures/binary-tree/binary-tree.js +8 -29
  6. package/dist/data-structures/binary-tree/bst.d.ts +1 -1
  7. package/dist/data-structures/binary-tree/bst.js +3 -3
  8. package/dist/data-structures/binary-tree/rb-tree.d.ts +1 -3
  9. package/dist/data-structures/binary-tree/rb-tree.js +1 -7
  10. package/dist/data-structures/binary-tree/segment-tree.d.ts +10 -26
  11. package/dist/data-structures/binary-tree/segment-tree.js +10 -58
  12. package/dist/data-structures/binary-tree/tree-multiset.d.ts +1 -1
  13. package/dist/data-structures/binary-tree/tree-multiset.js +6 -6
  14. package/dist/data-structures/graph/abstract-graph.d.ts +5 -24
  15. package/dist/data-structures/graph/abstract-graph.js +4 -43
  16. package/dist/data-structures/graph/directed-graph.d.ts +4 -10
  17. package/dist/data-structures/graph/directed-graph.js +2 -20
  18. package/dist/data-structures/graph/map-graph.d.ts +4 -10
  19. package/dist/data-structures/graph/map-graph.js +2 -20
  20. package/dist/data-structures/graph/undirected-graph.d.ts +1 -8
  21. package/dist/data-structures/graph/undirected-graph.js +1 -14
  22. package/dist/data-structures/hash/coordinate-map.d.ts +0 -1
  23. package/dist/data-structures/hash/coordinate-map.js +0 -3
  24. package/dist/data-structures/hash/coordinate-set.d.ts +0 -1
  25. package/dist/data-structures/hash/coordinate-set.js +0 -3
  26. package/dist/data-structures/hash/hash-map.d.ts +8 -14
  27. package/dist/data-structures/hash/hash-map.js +4 -22
  28. package/dist/data-structures/hash/hash-table.d.ts +6 -9
  29. package/dist/data-structures/hash/hash-table.js +0 -9
  30. package/dist/data-structures/heap/heap.d.ts +12 -6
  31. package/dist/data-structures/heap/heap.js +40 -22
  32. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +6 -14
  33. package/dist/data-structures/linked-list/doubly-linked-list.js +18 -42
  34. package/dist/data-structures/linked-list/singly-linked-list.d.ts +5 -11
  35. package/dist/data-structures/linked-list/singly-linked-list.js +17 -35
  36. package/dist/data-structures/linked-list/skip-linked-list.d.ts +29 -10
  37. package/dist/data-structures/linked-list/skip-linked-list.js +62 -17
  38. package/dist/data-structures/matrix/matrix.d.ts +1 -1
  39. package/dist/data-structures/matrix/matrix2d.d.ts +1 -1
  40. package/dist/data-structures/matrix/navigator.d.ts +4 -4
  41. package/dist/data-structures/queue/deque.d.ts +8 -12
  42. package/dist/data-structures/queue/deque.js +31 -43
  43. package/dist/data-structures/queue/queue.d.ts +20 -5
  44. package/dist/data-structures/queue/queue.js +35 -18
  45. package/dist/data-structures/stack/stack.d.ts +2 -1
  46. package/dist/data-structures/stack/stack.js +10 -7
  47. package/dist/data-structures/tree/tree.d.ts +3 -9
  48. package/dist/data-structures/tree/tree.js +3 -21
  49. package/dist/data-structures/trie/trie.d.ts +6 -12
  50. package/dist/data-structures/trie/trie.js +6 -24
  51. package/dist/interfaces/binary-tree.d.ts +1 -1
  52. package/dist/types/data-structures/binary-tree/bst.d.ts +1 -1
  53. package/package.json +2 -2
  54. package/src/data-structures/binary-tree/avl-tree.ts +2 -4
  55. package/src/data-structures/binary-tree/binary-indexed-tree.ts +3 -15
  56. package/src/data-structures/binary-tree/binary-tree.ts +17 -42
  57. package/src/data-structures/binary-tree/bst.ts +5 -6
  58. package/src/data-structures/binary-tree/rb-tree.ts +13 -21
  59. package/src/data-structures/binary-tree/segment-tree.ts +16 -83
  60. package/src/data-structures/binary-tree/tree-multiset.ts +8 -9
  61. package/src/data-structures/graph/abstract-graph.ts +21 -67
  62. package/src/data-structures/graph/directed-graph.ts +13 -39
  63. package/src/data-structures/graph/map-graph.ts +7 -32
  64. package/src/data-structures/graph/undirected-graph.ts +9 -26
  65. package/src/data-structures/hash/coordinate-map.ts +0 -4
  66. package/src/data-structures/hash/coordinate-set.ts +0 -4
  67. package/src/data-structures/hash/hash-map.ts +13 -37
  68. package/src/data-structures/hash/hash-table.ts +6 -18
  69. package/src/data-structures/hash/tree-map.ts +2 -1
  70. package/src/data-structures/hash/tree-set.ts +2 -1
  71. package/src/data-structures/heap/heap.ts +58 -30
  72. package/src/data-structures/heap/max-heap.ts +1 -1
  73. package/src/data-structures/heap/min-heap.ts +1 -1
  74. package/src/data-structures/linked-list/doubly-linked-list.ts +26 -60
  75. package/src/data-structures/linked-list/singly-linked-list.ts +24 -49
  76. package/src/data-structures/linked-list/skip-linked-list.ts +73 -25
  77. package/src/data-structures/matrix/matrix.ts +2 -2
  78. package/src/data-structures/matrix/matrix2d.ts +1 -1
  79. package/src/data-structures/matrix/navigator.ts +4 -4
  80. package/src/data-structures/matrix/vector2d.ts +2 -1
  81. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -1
  82. package/src/data-structures/priority-queue/min-priority-queue.ts +1 -1
  83. package/src/data-structures/priority-queue/priority-queue.ts +1 -1
  84. package/src/data-structures/queue/deque.ts +38 -53
  85. package/src/data-structures/queue/queue.ts +38 -20
  86. package/src/data-structures/stack/stack.ts +13 -9
  87. package/src/data-structures/tree/tree.ts +7 -33
  88. package/src/data-structures/trie/trie.ts +14 -40
  89. package/src/interfaces/binary-tree.ts +1 -1
  90. package/src/types/data-structures/binary-tree/bst.ts +1 -1
  91. package/src/types/data-structures/matrix/navigator.ts +1 -1
  92. package/src/types/utils/utils.ts +1 -1
  93. package/src/types/utils/validate-type.ts +2 -2
@@ -15,27 +15,9 @@ class DoublyLinkedListNode {
15
15
  * is defined as a generic type "E".
16
16
  */
17
17
  constructor(value) {
18
- this._value = value;
19
- this._next = null;
20
- this._prev = null;
21
- }
22
- get value() {
23
- return this._value;
24
- }
25
- set value(value) {
26
- this._value = value;
27
- }
28
- get next() {
29
- return this._next;
30
- }
31
- set next(value) {
32
- this._next = value;
33
- }
34
- get prev() {
35
- return this._prev;
36
- }
37
- set prev(value) {
38
- this._prev = value;
18
+ this.value = value;
19
+ this.next = null;
20
+ this.prev = null;
39
21
  }
40
22
  }
41
23
  exports.DoublyLinkedListNode = DoublyLinkedListNode;
@@ -51,15 +33,9 @@ class DoublyLinkedList {
51
33
  get head() {
52
34
  return this._head;
53
35
  }
54
- set head(value) {
55
- this._head = value;
56
- }
57
36
  get tail() {
58
37
  return this._tail;
59
38
  }
60
- set tail(value) {
61
- this._tail = value;
62
- }
63
39
  get length() {
64
40
  return this._length;
65
41
  }
@@ -86,13 +62,13 @@ class DoublyLinkedList {
86
62
  push(value) {
87
63
  const newNode = new DoublyLinkedListNode(value);
88
64
  if (!this.head) {
89
- this.head = newNode;
90
- this.tail = newNode;
65
+ this._head = newNode;
66
+ this._tail = newNode;
91
67
  }
92
68
  else {
93
69
  newNode.prev = this.tail;
94
70
  this.tail.next = newNode;
95
- this.tail = newNode;
71
+ this._tail = newNode;
96
72
  }
97
73
  this._length++;
98
74
  }
@@ -113,11 +89,11 @@ class DoublyLinkedList {
113
89
  return undefined;
114
90
  const removedNode = this.tail;
115
91
  if (this.head === this.tail) {
116
- this.head = null;
117
- this.tail = null;
92
+ this._head = null;
93
+ this._tail = null;
118
94
  }
119
95
  else {
120
- this.tail = removedNode.prev;
96
+ this._tail = removedNode.prev;
121
97
  this.tail.next = null;
122
98
  }
123
99
  this._length--;
@@ -141,11 +117,11 @@ class DoublyLinkedList {
141
117
  return undefined;
142
118
  const removedNode = this.head;
143
119
  if (this.head === this.tail) {
144
- this.head = null;
145
- this.tail = null;
120
+ this._head = null;
121
+ this._tail = null;
146
122
  }
147
123
  else {
148
- this.head = removedNode.next;
124
+ this._head = removedNode.next;
149
125
  this.head.prev = null;
150
126
  }
151
127
  this._length--;
@@ -167,13 +143,13 @@ class DoublyLinkedList {
167
143
  unshift(value) {
168
144
  const newNode = new DoublyLinkedListNode(value);
169
145
  if (!this.head) {
170
- this.head = newNode;
171
- this.tail = newNode;
146
+ this._head = newNode;
147
+ this._tail = newNode;
172
148
  }
173
149
  else {
174
150
  newNode.next = this.head;
175
151
  this.head.prev = newNode;
176
- this.head = newNode;
152
+ this._head = newNode;
177
153
  }
178
154
  this._length++;
179
155
  }
@@ -308,7 +284,7 @@ class DoublyLinkedList {
308
284
  newNode.next = existingNode;
309
285
  existingNode.prev = newNode;
310
286
  if (existingNode === this.head) {
311
- this.head = newNode;
287
+ this._head = newNode;
312
288
  }
313
289
  this._length++;
314
290
  return true;
@@ -470,7 +446,7 @@ class DoublyLinkedList {
470
446
  */
471
447
  reverse() {
472
448
  let current = this.head;
473
- [this.head, this.tail] = [this.tail, this.head];
449
+ [this._head, this._tail] = [this.tail, this.head];
474
450
  while (current) {
475
451
  const next = current.next;
476
452
  [current.prev, current.next] = [current.next, current.prev];
@@ -572,7 +548,7 @@ class DoublyLinkedList {
572
548
  newNode.prev = existingNode;
573
549
  existingNode.next = newNode;
574
550
  if (existingNode === this.tail) {
575
- this.tail = newNode;
551
+ this._tail = newNode;
576
552
  }
577
553
  this._length++;
578
554
  return true;
@@ -6,31 +6,25 @@
6
6
  * @license MIT License
7
7
  */
8
8
  export declare class SinglyLinkedListNode<E = any> {
9
+ value: E;
10
+ next: SinglyLinkedListNode<E> | null;
9
11
  /**
10
12
  * The constructor function initializes an instance of a class with a given value and sets the next property to null.
11
13
  * @param {E} value - The "value" parameter is of type E, which means it can be any data type. It represents the value that
12
14
  * will be stored in the node of a linked list.
13
15
  */
14
16
  constructor(value: E);
15
- private _value;
16
- get value(): E;
17
- set value(value: E);
18
- private _next;
19
- get next(): SinglyLinkedListNode<E> | null;
20
- set next(value: SinglyLinkedListNode<E> | null);
21
17
  }
22
18
  export declare class SinglyLinkedList<E = any> {
23
19
  /**
24
20
  * The constructor initializes the linked list with an empty head, tail, and length.
25
21
  */
26
22
  constructor();
27
- private _head;
23
+ protected _head: SinglyLinkedListNode<E> | null;
28
24
  get head(): SinglyLinkedListNode<E> | null;
29
- set head(value: SinglyLinkedListNode<E> | null);
30
- private _tail;
25
+ protected _tail: SinglyLinkedListNode<E> | null;
31
26
  get tail(): SinglyLinkedListNode<E> | null;
32
- set tail(value: SinglyLinkedListNode<E> | null);
33
- private _length;
27
+ protected _length: number;
34
28
  get length(): number;
35
29
  /**
36
30
  * The `fromArray` function creates a new SinglyLinkedList instance and populates it with the elements from the given
@@ -15,20 +15,8 @@ class SinglyLinkedListNode {
15
15
  * will be stored in the node of a linked list.
16
16
  */
17
17
  constructor(value) {
18
- this._value = value;
19
- this._next = null;
20
- }
21
- get value() {
22
- return this._value;
23
- }
24
- set value(value) {
25
- this._value = value;
26
- }
27
- get next() {
28
- return this._next;
29
- }
30
- set next(value) {
31
- this._next = value;
18
+ this.value = value;
19
+ this.next = null;
32
20
  }
33
21
  }
34
22
  exports.SinglyLinkedListNode = SinglyLinkedListNode;
@@ -44,15 +32,9 @@ class SinglyLinkedList {
44
32
  get head() {
45
33
  return this._head;
46
34
  }
47
- set head(value) {
48
- this._head = value;
49
- }
50
35
  get tail() {
51
36
  return this._tail;
52
37
  }
53
- set tail(value) {
54
- this._tail = value;
55
- }
56
38
  get length() {
57
39
  return this._length;
58
40
  }
@@ -77,12 +59,12 @@ class SinglyLinkedList {
77
59
  push(value) {
78
60
  const newNode = new SinglyLinkedListNode(value);
79
61
  if (!this.head) {
80
- this.head = newNode;
81
- this.tail = newNode;
62
+ this._head = newNode;
63
+ this._tail = newNode;
82
64
  }
83
65
  else {
84
66
  this.tail.next = newNode;
85
- this.tail = newNode;
67
+ this._tail = newNode;
86
68
  }
87
69
  this._length++;
88
70
  }
@@ -105,8 +87,8 @@ class SinglyLinkedList {
105
87
  return undefined;
106
88
  if (this.head === this.tail) {
107
89
  const value = this.head.value;
108
- this.head = null;
109
- this.tail = null;
90
+ this._head = null;
91
+ this._tail = null;
110
92
  this._length--;
111
93
  return value;
112
94
  }
@@ -116,7 +98,7 @@ class SinglyLinkedList {
116
98
  }
117
99
  const value = this.tail.value;
118
100
  current.next = null;
119
- this.tail = current;
101
+ this._tail = current;
120
102
  this._length--;
121
103
  return value;
122
104
  }
@@ -137,7 +119,7 @@ class SinglyLinkedList {
137
119
  if (!this.head)
138
120
  return undefined;
139
121
  const removedNode = this.head;
140
- this.head = this.head.next;
122
+ this._head = this.head.next;
141
123
  this._length--;
142
124
  return removedNode.value;
143
125
  }
@@ -156,12 +138,12 @@ class SinglyLinkedList {
156
138
  unshift(value) {
157
139
  const newNode = new SinglyLinkedListNode(value);
158
140
  if (!this.head) {
159
- this.head = newNode;
160
- this.tail = newNode;
141
+ this._head = newNode;
142
+ this._tail = newNode;
161
143
  }
162
144
  else {
163
145
  newNode.next = this.head;
164
- this.head = newNode;
146
+ this._head = newNode;
165
147
  }
166
148
  this._length++;
167
149
  }
@@ -244,15 +226,15 @@ class SinglyLinkedList {
244
226
  while (current) {
245
227
  if (current.value === value) {
246
228
  if (prev === null) {
247
- this.head = current.next;
229
+ this._head = current.next;
248
230
  if (current === this.tail) {
249
- this.tail = null;
231
+ this._tail = null;
250
232
  }
251
233
  }
252
234
  else {
253
235
  prev.next = current.next;
254
236
  if (current === this.tail) {
255
- this.tail = prev;
237
+ this._tail = prev;
256
238
  }
257
239
  }
258
240
  this._length--;
@@ -335,7 +317,7 @@ class SinglyLinkedList {
335
317
  prev = current;
336
318
  current = next;
337
319
  }
338
- [this.head, this.tail] = [this.tail, this.head];
320
+ [this._head, this._tail] = [this.tail, this.head];
339
321
  }
340
322
  /**
341
323
  * The `find` function iterates through a linked list and returns the first element that satisfies a given condition.
@@ -445,7 +427,7 @@ class SinglyLinkedList {
445
427
  newNode.next = existingNode.next;
446
428
  existingNode.next = newNode;
447
429
  if (existingNode === this.tail) {
448
- this.tail = newNode;
430
+ this._tail = newNode;
449
431
  }
450
432
  this._length++;
451
433
  return true;
@@ -20,18 +20,14 @@ export declare class SkipList<K, V> {
20
20
  * level in the skip list. It is used to determine the height of each node in the skip list.
21
21
  */
22
22
  constructor(maxLevel?: number, probability?: number);
23
- private _head;
23
+ protected _head: SkipListNode<K, V>;
24
24
  get head(): SkipListNode<K, V>;
25
- set head(value: SkipListNode<K, V>);
26
- private _level;
25
+ protected _level: number;
27
26
  get level(): number;
28
- set level(value: number);
29
- private _maxLevel;
27
+ protected _maxLevel: number;
30
28
  get maxLevel(): number;
31
- set maxLevel(value: number);
32
- private _probability;
29
+ protected _probability: number;
33
30
  get probability(): number;
34
- set probability(value: number);
35
31
  /**
36
32
  * The add function adds a new node with a given key and value to a Skip List data structure.
37
33
  * @param {K} key - The key parameter represents the key of the node that needs to be added to the skip list.
@@ -46,6 +42,7 @@ export declare class SkipList<K, V> {
46
42
  * otherwise it returns `undefined`.
47
43
  */
48
44
  get(key: K): V | undefined;
45
+ has(key: K): boolean;
49
46
  /**
50
47
  * The `delete` function removes a node with a specific key from a Skip List data structure.
51
48
  * @param {K} key - The key parameter represents the key of the node that needs to be removed from the skip list.
@@ -54,8 +51,30 @@ export declare class SkipList<K, V> {
54
51
  */
55
52
  delete(key: K): boolean;
56
53
  /**
57
- * The function "randomLevel" generates a random level based on a given probability and maximum level.
54
+ * Get the value of the first element (the smallest element) in the Skip List.
55
+ * @returns The value of the first element, or undefined if the Skip List is empty.
56
+ */
57
+ getFirst(): V | undefined;
58
+ /**
59
+ * Get the value of the last element (the largest element) in the Skip List.
60
+ * @returns The value of the last element, or undefined if the Skip List is empty.
61
+ */
62
+ getLast(): V | undefined;
63
+ /**
64
+ * Get the value of the first element in the Skip List that is greater than the given key.
65
+ * @param key - the given key.
66
+ * @returns The value of the first element greater than the given key, or undefined if there is no such element.
67
+ */
68
+ higher(key: K): V | undefined;
69
+ /**
70
+ * Get the value of the last element in the Skip List that is less than the given key.
71
+ * @param key - the given key.
72
+ * @returns The value of the last element less than the given key, or undefined if there is no such element.
73
+ */
74
+ lower(key: K): V | undefined;
75
+ /**
76
+ * The function "_randomLevel" generates a random level based on a given probability and maximum level.
58
77
  * @returns the level, which is a number.
59
78
  */
60
- private randomLevel;
79
+ protected _randomLevel(): number;
61
80
  }
@@ -33,27 +33,15 @@ class SkipList {
33
33
  get head() {
34
34
  return this._head;
35
35
  }
36
- set head(value) {
37
- this._head = value;
38
- }
39
36
  get level() {
40
37
  return this._level;
41
38
  }
42
- set level(value) {
43
- this._level = value;
44
- }
45
39
  get maxLevel() {
46
40
  return this._maxLevel;
47
41
  }
48
- set maxLevel(value) {
49
- this._maxLevel = value;
50
- }
51
42
  get probability() {
52
43
  return this._probability;
53
44
  }
54
- set probability(value) {
55
- this._probability = value;
56
- }
57
45
  /**
58
46
  * The add function adds a new node with a given key and value to a Skip List data structure.
59
47
  * @param {K} key - The key parameter represents the key of the node that needs to be added to the skip list.
@@ -61,7 +49,7 @@ class SkipList {
61
49
  * List.
62
50
  */
63
51
  add(key, value) {
64
- const newNode = new SkipListNode(key, value, this.randomLevel());
52
+ const newNode = new SkipListNode(key, value, this._randomLevel());
65
53
  const update = new Array(this.maxLevel).fill(this.head);
66
54
  let current = this.head;
67
55
  for (let i = this.level - 1; i >= 0; i--) {
@@ -75,7 +63,7 @@ class SkipList {
75
63
  update[i].forward[i] = newNode;
76
64
  }
77
65
  if (newNode.forward[0] !== null) {
78
- this.level = Math.max(this.level, newNode.forward.length);
66
+ this._level = Math.max(this.level, newNode.forward.length);
79
67
  }
80
68
  }
81
69
  /**
@@ -97,6 +85,9 @@ class SkipList {
97
85
  }
98
86
  return undefined;
99
87
  }
88
+ has(key) {
89
+ return this.get(key) !== undefined;
90
+ }
100
91
  /**
101
92
  * The `delete` function removes a node with a specific key from a Skip List data structure.
102
93
  * @param {K} key - The key parameter represents the key of the node that needs to be removed from the skip list.
@@ -121,17 +112,71 @@ class SkipList {
121
112
  update[i].forward[i] = current.forward[i];
122
113
  }
123
114
  while (this.level > 0 && this.head.forward[this.level - 1] === null) {
124
- this.level--;
115
+ this._level--;
125
116
  }
126
117
  return true;
127
118
  }
128
119
  return false;
129
120
  }
130
121
  /**
131
- * The function "randomLevel" generates a random level based on a given probability and maximum level.
122
+ * Get the value of the first element (the smallest element) in the Skip List.
123
+ * @returns The value of the first element, or undefined if the Skip List is empty.
124
+ */
125
+ getFirst() {
126
+ const firstNode = this.head.forward[0];
127
+ return firstNode ? firstNode.value : undefined;
128
+ }
129
+ /**
130
+ * Get the value of the last element (the largest element) in the Skip List.
131
+ * @returns The value of the last element, or undefined if the Skip List is empty.
132
+ */
133
+ getLast() {
134
+ let current = this.head;
135
+ for (let i = this.level - 1; i >= 0; i--) {
136
+ while (current.forward[i]) {
137
+ current = current.forward[i];
138
+ }
139
+ }
140
+ return current.value;
141
+ }
142
+ /**
143
+ * Get the value of the first element in the Skip List that is greater than the given key.
144
+ * @param key - the given key.
145
+ * @returns The value of the first element greater than the given key, or undefined if there is no such element.
146
+ */
147
+ higher(key) {
148
+ let current = this.head;
149
+ for (let i = this.level - 1; i >= 0; i--) {
150
+ while (current.forward[i] && current.forward[i].key <= key) {
151
+ current = current.forward[i];
152
+ }
153
+ }
154
+ const nextNode = current.forward[0];
155
+ return nextNode ? nextNode.value : undefined;
156
+ }
157
+ /**
158
+ * Get the value of the last element in the Skip List that is less than the given key.
159
+ * @param key - the given key.
160
+ * @returns The value of the last element less than the given key, or undefined if there is no such element.
161
+ */
162
+ lower(key) {
163
+ let current = this.head;
164
+ let lastLess = null;
165
+ for (let i = this.level - 1; i >= 0; i--) {
166
+ while (current.forward[i] && current.forward[i].key < key) {
167
+ current = current.forward[i];
168
+ }
169
+ if (current.key < key) {
170
+ lastLess = current;
171
+ }
172
+ }
173
+ return lastLess ? lastLess.value : undefined;
174
+ }
175
+ /**
176
+ * The function "_randomLevel" generates a random level based on a given probability and maximum level.
132
177
  * @returns the level, which is a number.
133
178
  */
134
- randomLevel() {
179
+ _randomLevel() {
135
180
  let level = 1;
136
181
  while (Math.random() < this.probability && level < this.maxLevel) {
137
182
  level++;
@@ -6,7 +6,7 @@
6
6
  * @license MIT License
7
7
  */
8
8
  export declare class MatrixNTI2D<V = any> {
9
- private readonly _matrix;
9
+ protected readonly _matrix: Array<Array<V>>;
10
10
  /**
11
11
  * The constructor creates a matrix with the specified number of rows and columns, and initializes all elements to a
12
12
  * given initial value or 0 if not provided.
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Vector2D } from './vector2d';
9
9
  export declare class Matrix2D {
10
- private readonly _matrix;
10
+ protected readonly _matrix: number[][];
11
11
  /**
12
12
  * The constructor function initializes a Matrix2D object with either a default identity matrix, or a provided matrix
13
13
  * or Vector2D object.
@@ -21,10 +21,10 @@ export declare class Character {
21
21
  }
22
22
  export declare class Navigator<T = number> {
23
23
  onMove: (cur: [number, number]) => void;
24
- private readonly _matrix;
25
- private readonly _cur;
26
- private _character;
27
- private readonly _VISITED;
24
+ protected readonly _matrix: T[][];
25
+ protected readonly _cur: [number, number];
26
+ protected _character: Character;
27
+ protected readonly _VISITED: T;
28
28
  /**
29
29
  * The constructor initializes the Navigator object with the given parameters and sets the current position as visited
30
30
  * in the matrix.
@@ -10,20 +10,19 @@ export declare class Deque<E = any> extends DoublyLinkedList<E> {
10
10
  }
11
11
  export declare class ObjectDeque<E = number> {
12
12
  constructor(capacity?: number);
13
- private _nodes;
13
+ protected _nodes: {
14
+ [key: number]: E;
15
+ };
14
16
  get nodes(): {
15
17
  [p: number]: E;
16
18
  };
17
- private _capacity;
19
+ protected _capacity: number;
18
20
  get capacity(): number;
19
- set capacity(value: number);
20
- private _first;
21
+ protected _first: number;
21
22
  get first(): number;
22
- set first(value: number);
23
- private _last;
23
+ protected _last: number;
24
24
  get last(): number;
25
- set last(value: number);
26
- private _size;
25
+ protected _size: number;
27
26
  get size(): number;
28
27
  /**
29
28
  * The "addFirst" function adds a value to the beginning of an array-like data structure.
@@ -69,13 +68,10 @@ export declare class ObjectDeque<E = number> {
69
68
  * @returns The method is returning a boolean value indicating whether the size of the object is less than or equal to 0.
70
69
  */
71
70
  isEmpty(): boolean;
72
- protected _seNodes(value: {
73
- [p: number]: E;
74
- }): void;
75
- protected _setSize(value: number): void;
76
71
  }
77
72
  export declare class ArrayDeque<E> {
78
73
  protected _nodes: E[];
74
+ get nodes(): E[];
79
75
  get size(): number;
80
76
  /**
81
77
  * O(n) time complexity of adding at the beginning and the end