Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

red-black-tree-typed

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

red-black-tree-typed - npm Package Compare versions

Comparing version 1.49.1 to 1.49.2

11

dist/data-structures/base/iterable-base.d.ts

@@ -129,2 +129,8 @@ import { ElementCallback, EntryCallback, ReduceElementCallback, ReduceEntryCallback } from "../../types";

reduce<U>(callbackfn: ReduceEntryCallback<K, V, U>, initialValue: U): U;
hasValue(value: V): boolean;
/**
* Time Complexity: O(n)
* Space Complexity: O(n)
*/
print(): void;
protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;

@@ -232,3 +238,8 @@ }

reduce<U>(callbackfn: ReduceElementCallback<V, U>, initialValue: U): U;
/**
* Time Complexity: O(n)
* Space Complexity: O(n)
*/
print(): void;
protected abstract _getIterator(...args: any[]): IterableIterator<V>;
}

@@ -175,2 +175,16 @@ "use strict";

}
hasValue(value) {
for (const [, elementValue] of this) {
if (elementValue === value)
return true;
}
return false;
}
/**
* Time Complexity: O(n)
* Space Complexity: O(n)
*/
print() {
console.log([...this]);
}
}

@@ -312,3 +326,10 @@ exports.IterableEntryBase = IterableEntryBase;

}
/**
* Time Complexity: O(n)
* Space Complexity: O(n)
*/
print() {
console.log([...this]);
}
}
exports.IterableElementBase = IterableElementBase;

18

dist/data-structures/hash/hash-map.d.ts

@@ -45,3 +45,3 @@ /**

*/
set(key: K, value: V): void;
set(key: K, value: V): boolean;
/**

@@ -52,3 +52,3 @@ * The function "setMany" sets multiple key-value pairs in a map.

*/
setMany(elements: Iterable<[K, V]>): void;
setMany(elements: Iterable<[K, V]>): boolean[];
/**

@@ -119,2 +119,3 @@ * The `get` function retrieves a value from a map based on a given key, either from an object map or

print(): void;
put(key: K, value: V): boolean;
/**

@@ -184,6 +185,5 @@ * The function returns an iterator that yields key-value pairs from both an object store and an

*/
set(key: K, value?: V): number;
set(key: K, value?: V): boolean;
has(key: K): boolean;
hasValue(value: V): boolean;
setMany(entries: Iterable<[K, V]>): void;
setMany(entries: Iterable<[K, V]>): boolean[];
/**

@@ -214,3 +214,3 @@ * Time Complexity: O(1)

*/
getAt(index: number): [K, V];
getAt(index: number): V | undefined;
/**

@@ -236,3 +236,3 @@ * Time Complexity: O(1)

*/
deleteAt(index: number): number;
deleteAt(index: number): boolean;
/**

@@ -297,3 +297,3 @@ * Time Complexity: O(1)

map<NV>(callback: EntryCallback<K, V, NV>, thisArg?: any): LinkedHashMap<K, NV>;
print(): void;
put(key: K, value: V): boolean;
/**

@@ -316,3 +316,3 @@ * Time Complexity: O(n), where n is the number of elements in the LinkedHashMap.

*/
protected _deleteNode(node: HashMapLinkedNode<K, V | undefined>): void;
protected _deleteNode(node: HashMapLinkedNode<K, V | undefined>): boolean;
}

@@ -71,2 +71,3 @@ "use strict";

}
return true;
}

@@ -79,4 +80,6 @@ /**

setMany(elements) {
const results = [];
for (const [key, value] of elements)
this.set(key, value);
results.push(this.set(key, value));
return results;
}

@@ -199,2 +202,5 @@ /**

}
put(key, value) {
return this.set(key, value);
}
/**

@@ -363,3 +369,3 @@ * The function returns an iterator that yields key-value pairs from both an object store and an

}
return this._size;
return true;
}

@@ -376,14 +382,9 @@ has(key) {

}
hasValue(value) {
for (const [, elementValue] of this) {
if (elementValue === value)
return true;
}
return false;
}
setMany(entries) {
const results = [];
for (const entry of entries) {
const [key, value] = entry;
this.set(key, value);
results.push(this.set(key, value));
}
return results;
}

@@ -432,3 +433,3 @@ /**

}
return [node.key, node.value];
return node.value;
}

@@ -486,4 +487,3 @@ /**

}
this._deleteNode(node);
return this._size;
return this._deleteNode(node);
}

@@ -581,4 +581,4 @@ /**

}
print() {
console.log([...this]);
put(key, value) {
return this.set(key, value);
}

@@ -619,4 +619,5 @@ /**

this._size -= 1;
return true;
}
}
exports.LinkedHashMap = LinkedHashMap;

@@ -55,3 +55,3 @@ /**

*/
add(element: E): Heap<E>;
add(element: E): boolean;
/**

@@ -65,14 +65,2 @@ * Time Complexity: O(log n), where n is the number of elements in the heap.

*
* Insert an element into the heap and maintain the heap properties.
* @param element - The element to be inserted.
*/
push(element: E): Heap<E>;
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*
* Remove and return the top element (smallest or largest element) from the heap.

@@ -83,14 +71,2 @@ * @returns The top element or undefined if the heap is empty.

/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*
* Remove and return the top element (smallest or largest element) from the heap.
* @returns The top element or undefined if the heap is empty.
*/
pop(): E | undefined;
/**
* Peek at the top element of the heap without removing it.

@@ -120,3 +96,3 @@ * @returns The top element or undefined if the heap is empty.

*/
refill(elements: E[]): void;
refill(elements: E[]): boolean[];
/**

@@ -210,3 +186,3 @@ * Time Complexity: O(n), where n is the number of elements in the heap.

*/
fix(): void;
fix(): boolean[];
/**

@@ -258,9 +234,4 @@ * Time Complexity: O(n)

map<T>(callback: ElementCallback<E, T>, comparator: Comparator<T>, thisArg?: any): Heap<T>;
protected _getIterator(): IterableIterator<E>;
/**
* Time Complexity: O(log n)
* Space Complexity: O(1)
*/
print(): void;
protected _getIterator(): Generator<E, void, unknown>;
/**
* Time Complexity: O(n)

@@ -276,3 +247,3 @@ * Space Complexity: O(1)

*/
protected _bubbleUp(index: number): void;
protected _bubbleUp(index: number): boolean;
/**

@@ -286,3 +257,3 @@ * Time Complexity: O(log n)

*/
protected _sinkDown(index: number, halfLength: number): void;
protected _sinkDown(index: number, halfLength: number): boolean;
}

@@ -289,0 +260,0 @@ export declare class FibonacciHeapNode<E> {

@@ -45,3 +45,3 @@ "use strict";

for (const el of elements) {
this.push(el);
this.add(el);
}

@@ -89,19 +89,4 @@ // this.fix();

add(element) {
return this.push(element);
}
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*
* Insert an element into the heap and maintain the heap properties.
* @param element - The element to be inserted.
*/
push(element) {
this._elements.push(element);
this._bubbleUp(this.elements.length - 1);
return this;
return this._bubbleUp(this.elements.length - 1);
}

@@ -131,16 +116,2 @@ /**

/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*
* Remove and return the top element (smallest or largest element) from the heap.
* @returns The top element or undefined if the heap is empty.
*/
pop() {
return this.poll();
}
/**
* Peek at the top element of the heap without removing it.

@@ -178,3 +149,3 @@ * @returns The top element or undefined if the heap is empty.

this._elements = elements;
this.fix();
return this.fix();
}

@@ -216,3 +187,3 @@ /**

if (index === 0) {
this.pop();
this.poll();
}

@@ -329,4 +300,6 @@ else if (index === this.elements.length - 1) {

fix() {
const results = [];
for (let i = Math.floor(this.size / 2); i >= 0; i--)
this._sinkDown(i, this.elements.length >> 1);
results.push(this._sinkDown(i, this.elements.length >> 1));
return results;
}

@@ -358,3 +331,3 @@ /**

if (callback.call(thisArg, current, index, this)) {
filteredList.push(current);
filteredList.add(current);
}

@@ -398,9 +371,2 @@ index++;

}
/**
* Time Complexity: O(log n)
* Space Complexity: O(1)
*/
print() {
console.log([...this]);
}
*_getIterator() {

@@ -433,2 +399,3 @@ for (const element of this.elements) {

this.elements[index] = element;
return true;
}

@@ -460,2 +427,3 @@ /**

this.elements[index] = element;
return true;
}

@@ -462,0 +430,0 @@ }

@@ -29,3 +29,3 @@ /**

/**
* The constructor initializes the linked list with an empty head, tail, and length.
* The constructor initializes the linked list with an empty head, tail, and size.
*/

@@ -37,11 +37,10 @@ constructor(elements?: Iterable<E>);

get tail(): DoublyLinkedListNode<E> | undefined;
protected _length: number;
get length(): number;
protected _size: number;
get size(): number;
/**
* Time Complexity: O(n), where n is the length of the input array.
* Time Complexity: O(n), where n is the size of the input array.
* Space Complexity: O(n)
*/
/**
* Time Complexity: O(n), where n is the length of the input array.
* Time Complexity: O(n), where n is the size of the input array.
* Space Complexity: O(n)

@@ -66,3 +65,3 @@ *

*/
push(value: E): void;
push(value: E): boolean;
/**

@@ -76,14 +75,2 @@ * Time Complexity: O(1)

*
* The addLast function adds a new node with the given value to the end of the doubly linked list.
* @param {E} value - The value to be added to the linked list.
*/
addLast(value: E): void;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pop()` function removes and returns the value of the last node in a doubly linked list.

@@ -102,15 +89,2 @@ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the

*
* The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
* @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
* list is empty, it returns undefined.
*/
pollLast(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `shift()` function removes and returns the value of the first node in a doubly linked list.

@@ -129,15 +103,2 @@ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked

*
* The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
*/
pollFirst(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The unshift function adds a new node with the given value to the beginning of a doubly linked list.

@@ -147,17 +108,4 @@ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the

*/
unshift(value: E): void;
unshift(value: E): boolean;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
* @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
* doubly linked list.
*/
addFirst(value: E): void;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.

@@ -170,26 +118,2 @@ * Space Complexity: O(1)

*
* The `getFirst` function returns the first node in a doubly linked list, or undefined if the list is empty.
* @returns The method `getFirst()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
*/
getFirst(): E | undefined;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `getLast` function returns the last node in a doubly linked list, or undefined if the list is empty.
* @returns The method `getLast()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
*/
getLast(): E | undefined;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `getAt` function returns the value at a specified index in a linked list, or undefined if the index is out of bounds.

@@ -249,3 +173,3 @@ * @param {number} index - The index parameter is a number that represents the position of the element we want to

*/
insertAt(index: number, value: E): boolean;
addAt(index: number, value: E): boolean;
/**

@@ -259,3 +183,3 @@ * Time Complexity: O(n), where n is the number of elements in the linked list.

*
* The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
* The `addBefore` function inserts a new value before an existing value or node in a doubly linked list.
* @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list

@@ -269,3 +193,3 @@ * before which the new value will be inserted. It can be either the value of the existing node or the existing node

*/
insertBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
addBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
/**

@@ -279,3 +203,3 @@ * Time Complexity: O(n), where n is the number of elements in the linked list.

*
* The `insertAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* The `addAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list

@@ -288,3 +212,3 @@ * after which the new value will be inserted. It can be either the value of the existing node or the existing node

*/
insertAfter(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
addAfter(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean;
/**

@@ -304,3 +228,3 @@ * Time Complexity: O(n), where n is the number of elements in the linked list.

*/
deleteAt(index: number): E | undefined;
deleteAt(index: number): boolean;
/**

@@ -322,3 +246,3 @@ * Time Complexity: O(n), where n is the number of elements in the linked list.

/**
* The function checks if a variable has a length greater than zero and returns a boolean value.
* The function checks if a variable has a size greater than zero and returns a boolean value.
* @returns A boolean value is being returned.

@@ -328,3 +252,3 @@ */

/**
* The `clear` function resets the linked list by setting the head, tail, and length to undefined and 0 respectively.
* The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
*/

@@ -388,3 +312,3 @@ clear(): void;

*/
reverse(): void;
reverse(): this;
/**

@@ -459,7 +383,77 @@ * Time Complexity: O(n), where n is the number of elements in the linked list.

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addLast function adds a new node with the given value to the end of the doubly linked list.
* @param {E} value - The value to be added to the linked list.
*/
addLast(value: E): boolean;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
* @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
* list is empty, it returns undefined.
*/
pollLast(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
*/
pollFirst(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
* @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
* doubly linked list.
*/
addFirst(value: E): void;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(n)
* Space Complexity: O(1)
*/
print(): void;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `get first` function returns the first node in a doubly linked list, or undefined if the list is empty.
* @returns The method `get first()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
*/
get first(): E | undefined;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `get last` function returns the last node in a doubly linked list, or undefined if the list is empty.
* @returns The method `get last()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
*/
get last(): E | undefined;
/**
* The function returns an iterator that iterates over the values of a linked list.

@@ -466,0 +460,0 @@ */

@@ -26,3 +26,3 @@ "use strict";

/**
* The constructor initializes the linked list with an empty head, tail, and length.
* The constructor initializes the linked list with an empty head, tail, and size.
*/

@@ -33,3 +33,3 @@ constructor(elements) {

this._tail = undefined;
this._length = 0;
this._size = 0;
if (elements) {

@@ -47,14 +47,11 @@ for (const el of elements) {

}
get length() {
return this._length;
}
get size() {
return this.length;
return this._size;
}
/**
* Time Complexity: O(n), where n is the length of the input array.
* Time Complexity: O(n), where n is the size of the input array.
* Space Complexity: O(n)
*/
/**
* Time Complexity: O(n), where n is the length of the input array.
* Time Complexity: O(n), where n is the size of the input array.
* Space Complexity: O(n)

@@ -96,3 +93,4 @@ *

}
this._length++;
this._size++;
return true;
}

@@ -107,16 +105,2 @@ /**

*
* The addLast function adds a new node with the given value to the end of the doubly linked list.
* @param {E} value - The value to be added to the linked list.
*/
addLast(value) {
this.push(value);
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pop()` function removes and returns the value of the last node in a doubly linked list.

@@ -138,3 +122,3 @@ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the

}
this._length--;
this._size--;
return removedNode.value;

@@ -150,17 +134,2 @@ }

*
* The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
* @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
* list is empty, it returns undefined.
*/
pollLast() {
return this.pop();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `shift()` function removes and returns the value of the first node in a doubly linked list.

@@ -182,3 +151,3 @@ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked

}
this._length--;
this._size--;
return removedNode.value;

@@ -194,17 +163,2 @@ }

*
* The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
*/
pollFirst() {
return this.shift();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The unshift function adds a new node with the given value to the beginning of a doubly linked list.

@@ -225,20 +179,6 @@ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the

}
this._length++;
this._size++;
return true;
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
* @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
* doubly linked list.
*/
addFirst(value) {
this.unshift(value);
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.

@@ -251,32 +191,2 @@ * Space Complexity: O(1)

*
* The `getFirst` function returns the first node in a doubly linked list, or undefined if the list is empty.
* @returns The method `getFirst()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
*/
getFirst() {
var _a;
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `getLast` function returns the last node in a doubly linked list, or undefined if the list is empty.
* @returns The method `getLast()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
*/
getLast() {
var _a;
return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `getAt` function returns the value at a specified index in a linked list, or undefined if the index is out of bounds.

@@ -289,3 +199,3 @@ * @param {number} index - The index parameter is a number that represents the position of the element we want to

getAt(index) {
if (index < 0 || index >= this.length)
if (index < 0 || index >= this.size)
return undefined;

@@ -314,3 +224,3 @@ let current = this.head;

getNodeAt(index) {
if (index < 0 || index >= this.length)
if (index < 0 || index >= this.size)
return undefined;

@@ -363,4 +273,4 @@ let current = this.head;

*/
insertAt(index, value) {
if (index < 0 || index > this.length)
addAt(index, value) {
if (index < 0 || index > this.size)
return false;

@@ -371,3 +281,3 @@ if (index === 0) {

}
if (index === this.length) {
if (index === this.size) {
this.push(value);

@@ -383,3 +293,3 @@ return true;

nextNode.prev = newNode;
this._length++;
this._size++;
return true;

@@ -395,3 +305,3 @@ }

*
* The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
* The `addBefore` function inserts a new value before an existing value or node in a doubly linked list.
* @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list

@@ -405,3 +315,3 @@ * before which the new value will be inserted. It can be either the value of the existing node or the existing node

*/
insertBefore(existingValueOrNode, newValue) {
addBefore(existingValueOrNode, newValue) {
let existingNode;

@@ -425,3 +335,3 @@ if (existingValueOrNode instanceof DoublyLinkedListNode) {

}
this._length++;
this._size++;
return true;

@@ -439,3 +349,3 @@ }

*
* The `insertAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* The `addAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list

@@ -448,3 +358,3 @@ * after which the new value will be inserted. It can be either the value of the existing node or the existing node

*/
insertAfter(existingValueOrNode, newValue) {
addAfter(existingValueOrNode, newValue) {
let existingNode;

@@ -468,3 +378,3 @@ if (existingValueOrNode instanceof DoublyLinkedListNode) {

}
this._length++;
this._size++;
return true;

@@ -489,8 +399,12 @@ }

deleteAt(index) {
if (index < 0 || index >= this.length)
return undefined;
if (index === 0)
return this.shift();
if (index === this.length - 1)
return this.pop();
if (index < 0 || index >= this.size)
return false;
if (index === 0) {
this.shift();
return true;
}
if (index === this.size - 1) {
this.pop();
return true;
}
const removedNode = this.getNodeAt(index);

@@ -501,4 +415,4 @@ const prevNode = removedNode.prev;

nextNode.prev = prevNode;
this._length--;
return removedNode.value;
this._size--;
return true;
}

@@ -539,3 +453,3 @@ /**

nextNode.prev = prevNode;
this._length--;
this._size--;
}

@@ -547,10 +461,10 @@ return true;

/**
* The function checks if a variable has a length greater than zero and returns a boolean value.
* The function checks if a variable has a size greater than zero and returns a boolean value.
* @returns A boolean value is being returned.
*/
isEmpty() {
return this.length === 0;
return this.size === 0;
}
/**
* The `clear` function resets the linked list by setting the head, tail, and length to undefined and 0 respectively.
* The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
*/

@@ -560,3 +474,3 @@ clear() {

this._tail = undefined;
this._length = 0;
this._size = 0;
}

@@ -656,2 +570,3 @@ /**

}
return this;
}

@@ -761,9 +676,91 @@ /**

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addLast function adds a new node with the given value to the end of the doubly linked list.
* @param {E} value - The value to be added to the linked list.
*/
addLast(value) {
return this.push(value);
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
* @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
* list is empty, it returns undefined.
*/
pollLast() {
return this.pop();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
*/
pollFirst() {
return this.shift();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
* @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
* doubly linked list.
*/
addFirst(value) {
this.unshift(value);
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(n)
* Space Complexity: O(1)
*/
print() {
console.log([...this]);
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `get first` function returns the first node in a doubly linked list, or undefined if the list is empty.
* @returns The method `get first()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
*/
get first() {
var _a;
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `get last` function returns the last node in a doubly linked list, or undefined if the list is empty.
* @returns The method `get last()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
*/
get last() {
var _a;
return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* The function returns an iterator that iterates over the values of a linked list.

@@ -770,0 +767,0 @@ */

@@ -29,4 +29,4 @@ /**

get tail(): SinglyLinkedListNode<E> | undefined;
protected _length: number;
get length(): number;
protected _size: number;
get size(): number;
/**

@@ -58,3 +58,3 @@ * Time Complexity: O(n) - Linear time, where n is the length of the input array, as it performs a loop to push each element into the linked list.

*/
push(value: E): void;
push(value: E): boolean;
/**

@@ -72,3 +72,3 @@ * Time Complexity: O(1) - Constant time, as it involves basic pointer adjustments.

*/
addLast(value: E): void;
addLast(value: E): boolean;
/**

@@ -138,3 +138,3 @@ * Time Complexity: O(n) - Linear time in the worst case, as it may need to traverse the list to find the last element.

*/
unshift(value: E): void;
unshift(value: E): boolean;
/**

@@ -152,3 +152,3 @@ * Time Complexity: O(1) - Constant time, as it involves adjusting pointers at the head.

*/
addFirst(value: E): void;
addFirst(value: E): boolean;
/**

@@ -198,3 +198,3 @@ * Time Complexity: O(n) - Linear time, where n is the index, as it may need to traverse the list to find the desired node.

*/
deleteAt(index: number): E | undefined;
deleteAt(index: number): boolean;
/**

@@ -214,3 +214,3 @@ * Time Complexity: O(n) - Linear time, where n is the index, as it may need to traverse the list to find the desired node.

*/
delete(valueOrNode: E | SinglyLinkedListNode<E> | undefined | undefined): boolean;
delete(valueOrNode: E | SinglyLinkedListNode<E> | undefined): boolean;
/**

@@ -224,3 +224,3 @@ * Time Complexity: O(n) - Linear time, where n is the index, as it may need to traverse the list to find the desired node.

*
* The `insertAt` function inserts a value at a specified index in a singly linked list.
* The `addAt` function inserts a value at a specified index in a singly linked list.
* @param {number} index - The index parameter represents the position at which the new value should be inserted in the

@@ -233,3 +233,3 @@ * linked list. It is of type number.

*/
insertAt(index: number, value: E): boolean;
addAt(index: number, value: E): boolean;
/**

@@ -268,3 +268,3 @@ * The function checks if the length of a data structure is equal to zero and returns a boolean value indicating

*/
reverse(): void;
reverse(): this;
/**

@@ -322,10 +322,10 @@ * Time Complexity: O(n) - Linear time, where n is the length of the list, as it needs to reverse the pointers of each node.

*
* The `insertBefore` function inserts a new value before an existing value in a singly linked list.
* The `addBefore` function inserts a new value before an existing value in a singly linked list.
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node that you want to insert the
* new value before. It can be either the value itself or a node containing the value in the linked list.
* @param {E} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
* @returns The method `insertBefore` returns a boolean value. It returns `true` if the new value was successfully
* @returns The method `addBefore` returns a boolean value. It returns `true` if the new value was successfully
* inserted before the existing value, and `false` otherwise.
*/
insertBefore(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean;
addBefore(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean;
/**

@@ -339,3 +339,3 @@ * Time Complexity: O(n) - Linear time, where n is the length of the list, as it needs to reverse the pointers of each node.

*
* The `insertAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* The `addAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node in the linked list after which

@@ -347,3 +347,3 @@ * the new value will be inserted. It can be either the value of the existing node or the existing node itself.

*/
insertAfter(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean;
addAfter(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean;
/**

@@ -403,8 +403,3 @@ * Time Complexity: O(n) - Linear time, where n is the length of the list, as it needs to reverse the pointers of each node.

map<T>(callback: ElementCallback<E, T>, thisArg?: any): SinglyLinkedList<T>;
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(n)
*/
print(): void;
protected _getIterator(): IterableIterator<E>;
}

@@ -25,3 +25,3 @@ "use strict";

this._tail = undefined;
this._length = 0;
this._size = 0;
if (elements) {

@@ -38,4 +38,4 @@ for (const el of elements)

}
get length() {
return this._length;
get size() {
return this._size;
}

@@ -84,3 +84,4 @@ /**

}
this._length++;
this._size++;
return true;
}

@@ -100,3 +101,3 @@ /**

addLast(value) {
this.push(value);
return this.push(value);
}

@@ -123,3 +124,3 @@ /**

this._tail = undefined;
this._length--;
this._size--;
return value;

@@ -134,3 +135,3 @@ }

this._tail = current;
this._length--;
this._size--;
return value;

@@ -170,3 +171,3 @@ }

this._head = this.head.next;
this._length--;
this._size--;
return removedNode.value;

@@ -210,3 +211,4 @@ }

}
this._length++;
this._size++;
return true;
}

@@ -226,3 +228,3 @@ /**

addFirst(value) {
this.unshift(value);
return this.unshift(value);
}

@@ -244,3 +246,3 @@ /**

getAt(index) {
if (index < 0 || index >= this.length)
if (index < 0 || index >= this.size)
return undefined;

@@ -289,13 +291,17 @@ let current = this.head;

deleteAt(index) {
if (index < 0 || index >= this.length)
return undefined;
if (index === 0)
return this.shift();
if (index === this.length - 1)
return this.pop();
if (index < 0 || index >= this.size)
return false;
if (index === 0) {
this.shift();
return true;
}
if (index === this.size - 1) {
this.pop();
return true;
}
const prevNode = this.getNodeAt(index - 1);
const removedNode = prevNode.next;
prevNode.next = removedNode.next;
this._length--;
return removedNode.value;
this._size--;
return true;
}

@@ -341,3 +347,3 @@ /**

}
this._length--;
this._size--;
return true;

@@ -358,3 +364,3 @@ }

*
* The `insertAt` function inserts a value at a specified index in a singly linked list.
* The `addAt` function inserts a value at a specified index in a singly linked list.
* @param {number} index - The index parameter represents the position at which the new value should be inserted in the

@@ -367,4 +373,4 @@ * linked list. It is of type number.

*/
insertAt(index, value) {
if (index < 0 || index > this.length)
addAt(index, value) {
if (index < 0 || index > this.size)
return false;

@@ -375,3 +381,3 @@ if (index === 0) {

}
if (index === this.length) {
if (index === this.size) {
this.push(value);

@@ -384,3 +390,3 @@ return true;

prevNode.next = newNode;
this._length++;
this._size++;
return true;

@@ -394,3 +400,3 @@ }

isEmpty() {
return this.length === 0;
return this.size === 0;
}

@@ -403,3 +409,3 @@ /**

this._tail = undefined;
this._length = 0;
this._size = 0;
}

@@ -439,3 +445,3 @@ /**

if (!this.head || this.head === this.tail)
return;
return this;
let prev = undefined;

@@ -451,2 +457,3 @@ let current = this.head;

[this._head, this._tail] = [this.tail, this.head];
return this;
}

@@ -534,10 +541,10 @@ /**

*
* The `insertBefore` function inserts a new value before an existing value in a singly linked list.
* The `addBefore` function inserts a new value before an existing value in a singly linked list.
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node that you want to insert the
* new value before. It can be either the value itself or a node containing the value in the linked list.
* @param {E} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
* @returns The method `insertBefore` returns a boolean value. It returns `true` if the new value was successfully
* @returns The method `addBefore` returns a boolean value. It returns `true` if the new value was successfully
* inserted before the existing value, and `false` otherwise.
*/
insertBefore(existingValueOrNode, newValue) {
addBefore(existingValueOrNode, newValue) {
if (!this.head)

@@ -562,3 +569,3 @@ return false;

current.next = newNode;
this._length++;
this._size++;
return true;

@@ -578,3 +585,3 @@ }

*
* The `insertAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* The `addAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node in the linked list after which

@@ -586,3 +593,3 @@ * the new value will be inserted. It can be either the value of the existing node or the existing node itself.

*/
insertAfter(existingValueOrNode, newValue) {
addAfter(existingValueOrNode, newValue) {
let existingNode;

@@ -602,3 +609,3 @@ if (existingValueOrNode instanceof SinglyLinkedListNode) {

}
this._length++;
this._size++;
return true;

@@ -690,9 +697,2 @@ }

}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(n)
*/
print() {
console.log([...this]);
}
*_getIterator() {

@@ -699,0 +699,0 @@ let current = this.head;

@@ -93,3 +93,3 @@ /**

*/
getFirst(): V | undefined;
get first(): V | undefined;
/**

@@ -106,3 +106,3 @@ * Time Complexity: O(log n) - where n is the number of elements in the SkipList, as it traverses the levels of the SkipList.

*/
getLast(): V | undefined;
get last(): V | undefined;
/**

@@ -109,0 +109,0 @@ * Time Complexity: O(log n) - where n is the number of elements in the SkipList, as it traverses the levels of the SkipList.

@@ -161,3 +161,3 @@ "use strict";

*/
getFirst() {
get first() {
const firstNode = this.head.forward[0];

@@ -177,3 +177,3 @@ return firstNode ? firstNode.value : undefined;

*/
getLast() {
get last() {
let current = this.head;

@@ -180,0 +180,0 @@ for (let i = this.level - 1; i >= 0; i--) {

@@ -46,64 +46,2 @@ /**

/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*/
isEmpty(): boolean;
/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(n) - In worst case, resizing doubles the array size.
*
* The addLast function adds an element to the end of an array.
* @param {E} element - The element parameter represents the element that you want to add to the end of the
* data structure.
*/
addLast(element: E): void;
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*/
/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*
* The function "pollLast" removes and returns the last element of an array.
* @returns The last element of the array is being returned.
*/
pollLast(): E | undefined;
/**
* Time Complexity: O(1).
* Space Complexity: O(n) - Due to potential resizing.
*
* The "addFirst" function adds an element to the beginning of an array.
* @param {E} element - The parameter "element" represents the element that you want to add to the
* beginning of the data structure.
*/
addFirst(element: E): void;
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*
* The function "pollFirst" removes and returns the first element of an array.
* @returns The method `pollFirst()` is returning the first element of the array after removing it
* from the beginning. If the array is empty, it will return `undefined`.
*/
pollFirst(): E | undefined;
/**
* The clear() function resets the state of the object by initializing all variables to their default
* values.
*/
clear(): void;
/**
* The below function is a generator that yields elements from a collection one by one.
*/
begin(): Generator<E>;
/**
* The function `reverseBegin()` is a generator that yields elements in reverse order starting from
* the last element.
*/
reverseBegin(): Generator<E>;
/**
* Time Complexity - Amortized O(1) (possible reallocation)

@@ -121,3 +59,3 @@ * Space Complexity - O(n) (due to potential resizing).

*/
push(element: E): number;
push(element: E): boolean;
/**

@@ -150,3 +88,3 @@ * Time Complexity: O(1)

*/
unshift(element: E): number;
unshift(element: E): boolean;
/**

@@ -167,2 +105,21 @@ * Time Complexity: O(1)

/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*/
isEmpty(): boolean;
/**
* The clear() function resets the state of the object by initializing all variables to their default
* values.
*/
clear(): void;
/**
* The below function is a generator that yields elements from a collection one by one.
*/
begin(): Generator<E>;
/**
* The function `reverseBegin()` is a generator that yields elements in reverse order starting from
* the last element.
*/
reverseBegin(): Generator<E>;
/**
* Time Complexity: O(1)

@@ -196,3 +153,3 @@ * Space Complexity: O(1)

*/
setAt(pos: number, element: E): void;
setAt(pos: number, element: E): boolean;
/**

@@ -206,3 +163,3 @@ * Time Complexity: O(n)

*
* The `insertAt` function inserts one or more elements at a specified position in an array-like data
* The `addAt` function inserts one or more elements at a specified position in an array-like data
* structure.

@@ -218,3 +175,3 @@ * @param {number} pos - The `pos` parameter represents the position at which the element(s) should

*/
insertAt(pos: number, element: E, num?: number): number;
addAt(pos: number, element: E, num?: number): boolean;
/**

@@ -250,3 +207,3 @@ * Time Complexity: O(1)

*/
deleteAt(pos: number): number;
deleteAt(pos: number): boolean;
/**

@@ -266,3 +223,3 @@ * Time Complexity: O(n)

*/
delete(element: E): number;
delete(element: E): boolean;
/**

@@ -294,3 +251,3 @@ * Time Complexity: O(n)

*/
unique(): number;
unique(): this;
/**

@@ -308,3 +265,3 @@ * Time Complexity: O(n log n)

* the elements in the sorted array.
* @returns The method is returning the sorted instance of the object on which the method is called.
* @returns Deque<E>
*/

@@ -410,7 +367,45 @@ sort(comparator?: (x: E, y: E) => number): this;

/**
* Time Complexity: O(n)
* Space Complexity: O(n)
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
print(): void;
/**
* Time Complexity: O(1)
* Space Complexity: O(n) - In worst case, resizing doubles the array size.
*
* The addLast function adds an element to the end of an array.
* @param {E} element - The element parameter represents the element that you want to add to the end of the
* data structure.
*/
addLast(element: E): boolean;
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*/
/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*
* The function "pollLast" removes and returns the last element of an array.
* @returns The last element of the array is being returned.
*/
pollLast(): E | undefined;
/**
* Time Complexity: O(1).
* Space Complexity: O(n) - Due to potential resizing.
*
* The "addFirst" function adds an element to the beginning of an array.
* @param {E} element - The parameter "element" represents the element that you want to add to the
* beginning of the data structure.
*/
addFirst(element: E): boolean;
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*
* The function "pollFirst" removes and returns the first element of an array.
* @returns The method `pollFirst()` is returning the first element of the array after removing it
* from the beginning. If the array is empty, it will return `undefined`.
*/
pollFirst(): E | undefined;
/**
* Time Complexity: O(n)

@@ -422,3 +417,3 @@ * Space Complexity: O(1)

*/
protected _getIterator(): Generator<E, void, unknown>;
protected _getIterator(): IterableIterator<E>;
/**

@@ -425,0 +420,0 @@ * Time Complexity: O(n)

@@ -79,91 +79,2 @@ "use strict";

/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*/
isEmpty() {
return this.size === 0;
}
/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(n) - In worst case, resizing doubles the array size.
*
* The addLast function adds an element to the end of an array.
* @param {E} element - The element parameter represents the element that you want to add to the end of the
* data structure.
*/
addLast(element) {
this.push(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*/
/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*
* The function "pollLast" removes and returns the last element of an array.
* @returns The last element of the array is being returned.
*/
pollLast() {
return this.pop();
}
/**
* Time Complexity: O(1).
* Space Complexity: O(n) - Due to potential resizing.
*
* The "addFirst" function adds an element to the beginning of an array.
* @param {E} element - The parameter "element" represents the element that you want to add to the
* beginning of the data structure.
*/
addFirst(element) {
this.unshift(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*
* The function "pollFirst" removes and returns the first element of an array.
* @returns The method `pollFirst()` is returning the first element of the array after removing it
* from the beginning. If the array is empty, it will return `undefined`.
*/
pollFirst() {
return this.shift();
}
/**
* The clear() function resets the state of the object by initializing all variables to their default
* values.
*/
clear() {
this._buckets = [new Array(this._bucketSize)];
this._bucketCount = 1;
this._bucketFirst = this._bucketLast = this._size = 0;
this._firstInBucket = this._lastInBucket = this._bucketSize >> 1;
}
/**
* The below function is a generator that yields elements from a collection one by one.
*/
*begin() {
let index = 0;
while (index < this.size) {
yield this.getAt(index);
index++;
}
}
/**
* The function `reverseBegin()` is a generator that yields elements in reverse order starting from
* the last element.
*/
*reverseBegin() {
let index = this.size - 1;
while (index >= 0) {
yield this.getAt(index);
index--;
}
}
/**
* Time Complexity - Amortized O(1) (possible reallocation)

@@ -200,3 +111,3 @@ * Space Complexity - O(n) (due to potential resizing).

this._buckets[this._bucketLast][this._lastInBucket] = element;
return this.size;
return true;
}

@@ -268,3 +179,3 @@ /**

this._buckets[this._bucketFirst][this._firstInBucket] = element;
return this.size;
return true;
}

@@ -305,2 +216,40 @@ /**

/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*/
isEmpty() {
return this.size === 0;
}
/**
* The clear() function resets the state of the object by initializing all variables to their default
* values.
*/
clear() {
this._buckets = [new Array(this._bucketSize)];
this._bucketCount = 1;
this._bucketFirst = this._bucketLast = this._size = 0;
this._firstInBucket = this._lastInBucket = this._bucketSize >> 1;
}
/**
* The below function is a generator that yields elements from a collection one by one.
*/
*begin() {
let index = 0;
while (index < this.size) {
yield this.getAt(index);
index++;
}
}
/**
* The function `reverseBegin()` is a generator that yields elements in reverse order starting from
* the last element.
*/
*reverseBegin() {
let index = this.size - 1;
while (index >= 0) {
yield this.getAt(index);
index--;
}
}
/**
* Time Complexity: O(1)

@@ -342,2 +291,3 @@ * Space Complexity: O(1)

this._buckets[bucketIndex][indexInBucket] = element;
return true;
}

@@ -352,3 +302,3 @@ /**

*
* The `insertAt` function inserts one or more elements at a specified position in an array-like data
* The `addAt` function inserts one or more elements at a specified position in an array-like data
* structure.

@@ -364,3 +314,3 @@ * @param {number} pos - The `pos` parameter represents the position at which the element(s) should

*/
insertAt(pos, element, num = 1) {
addAt(pos, element, num = 1) {
const length = this.size;

@@ -387,3 +337,3 @@ (0, utils_1.rangeCheck)(pos, 0, length);

}
return this.size;
return true;
}

@@ -447,3 +397,3 @@ /**

}
return this.size;
return true;
}

@@ -467,3 +417,3 @@ /**

if (size === 0)
return 0;
return false;
let i = 0;

@@ -480,3 +430,3 @@ let index = 0;

this.cut(index - 1);
return this.size;
return true;
}

@@ -521,3 +471,3 @@ /**

if (this.size <= 1) {
return this.size;
return this;
}

@@ -534,3 +484,3 @@ let index = 1;

this.cut(index - 1);
return this.size;
return this;
}

@@ -549,3 +499,3 @@ /**

* the elements in the sorted array.
* @returns The method is returning the sorted instance of the object on which the method is called.
* @returns Deque<E>
*/

@@ -621,3 +571,3 @@ sort(comparator) {

}
return undefined;
return;
}

@@ -659,7 +609,3 @@ /**

toArray() {
const arr = [];
for (let i = 0; i < this.size; ++i) {
arr.push(this.getAt(i));
}
return arr;
return [...this];
}

@@ -724,9 +670,53 @@ /**

/**
* Time Complexity: O(n)
* Space Complexity: O(n)
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
print() {
console.log([...this]);
/**
* Time Complexity: O(1)
* Space Complexity: O(n) - In worst case, resizing doubles the array size.
*
* The addLast function adds an element to the end of an array.
* @param {E} element - The element parameter represents the element that you want to add to the end of the
* data structure.
*/
addLast(element) {
return this.push(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*/
/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*
* The function "pollLast" removes and returns the last element of an array.
* @returns The last element of the array is being returned.
*/
pollLast() {
return this.pop();
}
/**
* Time Complexity: O(1).
* Space Complexity: O(n) - Due to potential resizing.
*
* The "addFirst" function adds an element to the beginning of an array.
* @param {E} element - The parameter "element" represents the element that you want to add to the
* beginning of the data structure.
*/
addFirst(element) {
return this.unshift(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*
* The function "pollFirst" removes and returns the first element of an array.
* @returns The method `pollFirst()` is returning the first element of the array after removing it
* from the beginning. If the array is empty, it will return `undefined`.
*/
pollFirst() {
return this.shift();
}
/**
* Time Complexity: O(n)

@@ -733,0 +723,0 @@ * Space Complexity: O(1)

@@ -56,3 +56,3 @@ /**

*/
push(element: E): Queue<E>;
push(element: E): boolean;
/**

@@ -79,7 +79,7 @@ * Time Complexity: O(n) - where n is the number of elements in the queue. In the worst case, it may need to shift all elements to update the offset.

*
* The `getFirst` function returns the first element of the array `_nodes` if it exists, otherwise it returns `undefined`.
* @returns The `getFirst()` method returns the first element of the data structure, represented by the `_nodes` array at
* The `first` function returns the first element of the array `_nodes` if it exists, otherwise it returns `undefined`.
* @returns The `get first()` method returns the first element of the data structure, represented by the `_nodes` array at
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
*/
getFirst(): E | undefined;
get first(): E | undefined;
/**

@@ -106,7 +106,7 @@ * Time Complexity: O(1) - constant time as it retrieves the value at the current offset.

*
* The `getLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `getLast()` returns the last element of the `_nodes` array if the array is not empty. If the
* The `last` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `get last()` returns the last element of the `_nodes` array if the array is not empty. If the
* array is empty, it returns `undefined`.
*/
getLast(): E | undefined;
get last(): E | undefined;
/**

@@ -136,3 +136,3 @@ * Time Complexity: O(1) - constant time as it retrieves the value at the current offset.

*/
enqueue(value: E): Queue<E>;
enqueue(value: E): boolean;
/**

@@ -201,3 +201,2 @@ * Time Complexity: O(n) - same as shift().

clone(): Queue<E>;
print(): void;
/**

@@ -247,3 +246,3 @@ * Time Complexity: O(n)

*/
protected _getIterator(): Generator<E, void, unknown>;
protected _getIterator(): IterableIterator<E>;
}

@@ -261,3 +260,3 @@ /**

*/
enqueue(value: E): void;
enqueue(value: E): boolean;
/**

@@ -269,6 +268,6 @@ * The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.

/**
* The `getFirst` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `getFirst()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
* The `get first` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `get first()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
*/
getFirst(): E | undefined;
get first(): E | undefined;
/**

@@ -275,0 +274,0 @@ * The `peek` function returns the value of the head node in a linked list, or `undefined` if the list is empty.

@@ -65,3 +65,3 @@ "use strict";

this.nodes.push(element);
return this;
return true;
}

@@ -83,3 +83,3 @@ /**

return undefined;
const first = this.getFirst();
const first = this.first;
this._offset += 1;

@@ -102,7 +102,7 @@ if (this.offset * 2 < this.nodes.length)

*
* The `getFirst` function returns the first element of the array `_nodes` if it exists, otherwise it returns `undefined`.
* @returns The `getFirst()` method returns the first element of the data structure, represented by the `_nodes` array at
* The `first` function returns the first element of the array `_nodes` if it exists, otherwise it returns `undefined`.
* @returns The `get first()` method returns the first element of the data structure, represented by the `_nodes` array at
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
*/
getFirst() {
get first() {
return this.size > 0 ? this.nodes[this.offset] : undefined;

@@ -123,3 +123,3 @@ }

peek() {
return this.getFirst();
return this.first;
}

@@ -134,7 +134,7 @@ /**

*
* The `getLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `getLast()` returns the last element of the `_nodes` array if the array is not empty. If the
* The `last` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `get last()` returns the last element of the `_nodes` array if the array is not empty. If the
* array is empty, it returns `undefined`.
*/
getLast() {
get last() {
return this.size > 0 ? this.nodes[this.nodes.length - 1] : undefined;

@@ -155,3 +155,3 @@ }

peekLast() {
return this.getLast();
return this.last;
}

@@ -248,5 +248,2 @@ /**

}
print() {
console.log([...this]);
}
/**

@@ -333,3 +330,3 @@ * Time Complexity: O(n)

enqueue(value) {
this.push(value);
return this.push(value);
}

@@ -344,6 +341,6 @@ /**

/**
* The `getFirst` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `getFirst()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
* The `get first` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `get first()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
*/
getFirst() {
get first() {
var _a;

@@ -357,5 +354,5 @@ return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;

peek() {
return this.getFirst();
return this.first;
}
}
exports.LinkedListQueue = LinkedListQueue;

@@ -76,3 +76,3 @@ /**

*/
push(element: E): Stack<E>;
push(element: E): boolean;
/**

@@ -158,3 +158,2 @@ * Time Complexity: O(1), as it only involves accessing the last element of the array.

map<T>(callback: ElementCallback<E, T>, thisArg?: any): Stack<T>;
print(): void;
/**

@@ -164,3 +163,3 @@ * Custom iterator for the Stack class.

*/
protected _getIterator(): Generator<E, void, unknown>;
protected _getIterator(): IterableIterator<E>;
}

@@ -92,3 +92,3 @@ "use strict";

this.elements.push(element);
return this;
return true;
}

@@ -109,3 +109,3 @@ /**

if (this.isEmpty())
return undefined;
return;
return this.elements.pop();

@@ -204,5 +204,2 @@ }

}
print() {
console.log([...this]);
}
/**

@@ -209,0 +206,0 @@ * Custom iterator for the Stack class.

@@ -175,3 +175,3 @@ /**

*/
filter(predicate: ElementCallback<string, boolean>, thisArg?: any): string[];
filter(predicate: ElementCallback<string, boolean>, thisArg?: any): Trie;
/**

@@ -195,3 +195,2 @@ * Time Complexity: O(n)

map(callback: ElementCallback<string, string>, thisArg?: any): Trie;
print(): void;
protected _getIterator(): IterableIterator<string>;

@@ -198,0 +197,0 @@ /**

@@ -344,7 +344,7 @@ "use strict";

filter(predicate, thisArg) {
const results = [];
const results = new Trie();
let index = 0;
for (const word of this) {
if (predicate.call(thisArg, word, index, this)) {
results.push(word);
results.add(word);
}

@@ -381,5 +381,2 @@ index++;

}
print() {
console.log([...this]);
}
*_getIterator() {

@@ -386,0 +383,0 @@ function* _dfs(node, path) {

{
"name": "red-black-tree-typed",
"version": "1.49.1",
"version": "1.49.2",
"description": "RedBlackTree. Javascript & Typescript Data Structure.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -184,2 +184,17 @@ import { ElementCallback, EntryCallback, ReduceElementCallback, ReduceEntryCallback } from "../../types";

hasValue(value: V): boolean {
for (const [, elementValue] of this) {
if (elementValue === value) return true;
}
return false;
}
/**
* Time Complexity: O(n)
* Space Complexity: O(n)
*/
print(): void {
console.log([...this])
}
protected abstract _getIterator(...args: any[]): IterableIterator<[K, V]>;

@@ -329,3 +344,12 @@ }

/**
* Time Complexity: O(n)
* Space Complexity: O(n)
*/
print(): void {
console.log([...this])
}
protected abstract _getIterator(...args: any[]): IterableIterator<V>;
}

@@ -38,3 +38,2 @@ /**

this._hashFn = hashFn;
}

@@ -72,4 +71,3 @@ }

*/
set(key: K, value: V) {
set(key: K, value: V): boolean {
if (this._isObjKey(key)) {

@@ -88,2 +86,3 @@ if (!this._objMap.has(key)) {

}
return true;
}

@@ -96,4 +95,6 @@

*/
setMany(elements: Iterable<[K, V]>) {
for (const [key, value] of elements) this.set(key, value);
setMany(elements: Iterable<[K, V]>): boolean[] {
const results: boolean[] = [];
for (const [key, value] of elements) results.push(this.set(key, value));
return results;
}

@@ -222,2 +223,6 @@

put(key: K, value: V): boolean {
return this.set(key, value);
}
/**

@@ -294,3 +299,2 @@ * The function returns an iterator that yields key-value pairs from both an object store and an

}
}

@@ -365,3 +369,3 @@

*/
set(key: K, value?: V) {
set(key: K, value?: V): boolean {
let node;

@@ -408,3 +412,3 @@ const isNewKey = !this.has(key); // Check if the key is new

return this._size;
return true;
}

@@ -422,14 +426,9 @@

hasValue(value: V): boolean {
for (const [, elementValue] of this) {
if (elementValue === value) return true;
}
return false;
}
setMany(entries: Iterable<[K, V]>): void {
setMany(entries: Iterable<[K, V]>): boolean[] {
const results: boolean[] = [];
for (const entry of entries) {
const [key, value] = entry;
this.set(key, value);
results.push(this.set(key, value));
}
return results;
}

@@ -473,3 +472,3 @@

*/
getAt(index: number) {
getAt(index: number): V | undefined {
rangeCheck(index, 0, this._size - 1);

@@ -480,3 +479,3 @@ let node = this._head;

}
return <[K, V]>[node.key, node.value];
return node.value;
}

@@ -494,3 +493,3 @@

*/
delete(key: K) {
delete(key: K): boolean {
let node;

@@ -536,3 +535,3 @@

*/
deleteAt(index: number) {
deleteAt(index: number): boolean {
rangeCheck(index, 0, this._size - 1);

@@ -543,4 +542,3 @@ let node = this._head;

}
this._deleteNode(node);
return this._size;
return this._deleteNode(node);
}

@@ -556,3 +554,3 @@

*/
isEmpty() {
isEmpty(): boolean {
return this._size === 0;

@@ -567,3 +565,3 @@ }

*/
clear() {
clear(): void {
this._noObjMap = {};

@@ -648,4 +646,4 @@ this._size = 0;

print() {
console.log([...this]);
put(key: K, value: V): boolean {
return this.set(key, value);
}

@@ -677,3 +675,3 @@

*/
protected _deleteNode(node: HashMapLinkedNode<K, V | undefined>) {
protected _deleteNode(node: HashMapLinkedNode<K, V | undefined>): boolean {
const { prev, next } = node;

@@ -692,3 +690,4 @@ prev.next = next;

this._size -= 1;
return true;
}
}

@@ -45,3 +45,3 @@ /**

for (const el of elements) {
this.push(el);
this.add(el);
}

@@ -95,22 +95,5 @@ // this.fix();

*/
add(element: E): Heap<E> {
return this.push(element);
}
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*
* Insert an element into the heap and maintain the heap properties.
* @param element - The element to be inserted.
*/
push(element: E): Heap<E> {
add(element: E): boolean {
this._elements.push(element);
this._bubbleUp(this.elements.length - 1);
return this;
return this._bubbleUp(this.elements.length - 1);
}

@@ -142,18 +125,2 @@

/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(log n), where n is the number of elements in the heap.
* Space Complexity: O(1)
*
* Remove and return the top element (smallest or largest element) from the heap.
* @returns The top element or undefined if the heap is empty.
*/
pop(): E | undefined {
return this.poll();
}
/**
* Peek at the top element of the heap without removing it.

@@ -170,3 +137,3 @@ * @returns The top element or undefined if the heap is empty.

*/
isEmpty() {
isEmpty(): boolean {
return this.size === 0;

@@ -178,3 +145,3 @@ }

*/
clear() {
clear(): void {
this._elements = [];

@@ -195,5 +162,5 @@ }

*/
refill(elements: E[]) {
refill(elements: E[]): boolean[] {
this._elements = elements;
this.fix();
return this.fix();
}

@@ -234,7 +201,7 @@

*/
delete(element: E) {
delete(element: E): boolean {
const index = this.elements.indexOf(element);
if (index < 0) return false;
if (index === 0) {
this.pop();
this.poll();
} else if (index === this.elements.length - 1) {

@@ -358,4 +325,6 @@ this.elements.pop();

*/
fix() {
for (let i = Math.floor(this.size / 2); i >= 0; i--) this._sinkDown(i, this.elements.length >> 1);
fix(): boolean[] {
const results: boolean[] = [];
for (let i = Math.floor(this.size / 2); i >= 0; i--) results.push(this._sinkDown(i, this.elements.length >> 1));
return results;
}

@@ -389,3 +358,3 @@

if (callback.call(thisArg, current, index, this)) {
filteredList.push(current);
filteredList.add(current);
}

@@ -433,12 +402,3 @@ index++;

/**
* Time Complexity: O(log n)
* Space Complexity: O(1)
*/
print(): void {
console.log([...this]);
}
protected* _getIterator() {
protected* _getIterator(): IterableIterator<E> {
for (const element of this.elements) {

@@ -461,3 +421,3 @@ yield element;

*/
protected _bubbleUp(index: number) {
protected _bubbleUp(index: number): boolean {
const element = this.elements[index];

@@ -472,2 +432,3 @@ while (index > 0) {

this.elements[index] = element;
return true;
}

@@ -483,3 +444,3 @@

*/
protected _sinkDown(index: number, halfLength: number) {
protected _sinkDown(index: number, halfLength: number): boolean {
const element = this.elements[index];

@@ -502,2 +463,3 @@ while (index < halfLength) {

this.elements[index] = element;
return true;
}

@@ -504,0 +466,0 @@ }

@@ -36,3 +36,3 @@ /**

/**
* The constructor initializes the linked list with an empty head, tail, and length.
* The constructor initializes the linked list with an empty head, tail, and size.
*/

@@ -43,3 +43,3 @@ constructor(elements?: Iterable<E>) {

this._tail = undefined;
this._length = 0;
this._size = 0;
if (elements) {

@@ -64,14 +64,10 @@ for (const el of elements) {

protected _length: number;
protected _size: number;
get length(): number {
return this._length;
}
get size(): number {
return this.length;
return this._size;
}
/**
* Time Complexity: O(n), where n is the length of the input array.
* Time Complexity: O(n), where n is the size of the input array.
* Space Complexity: O(n)

@@ -81,3 +77,3 @@ */

/**
* Time Complexity: O(n), where n is the length of the input array.
* Time Complexity: O(n), where n is the size of the input array.
* Space Complexity: O(n)

@@ -110,3 +106,3 @@ *

*/
push(value: E): void {
push(value: E): boolean {
const newNode = new DoublyLinkedListNode(value);

@@ -121,3 +117,4 @@ if (!this.head) {

}
this._length++;
this._size++;
return true;
}

@@ -134,18 +131,2 @@

*
* The addLast function adds a new node with the given value to the end of the doubly linked list.
* @param {E} value - The value to be added to the linked list.
*/
addLast(value: E): void {
this.push(value);
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pop()` function removes and returns the value of the last node in a doubly linked list.

@@ -165,3 +146,3 @@ * @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the

}
this._length--;
this._size--;
return removedNode.value;

@@ -179,19 +160,2 @@ }

*
* The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
* @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
* list is empty, it returns undefined.
*/
pollLast(): E | undefined {
return this.pop();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `shift()` function removes and returns the value of the first node in a doubly linked list.

@@ -211,3 +175,3 @@ * @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked

}
this._length--;
this._size--;
return removedNode.value;

@@ -225,19 +189,2 @@ }

*
* The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
*/
pollFirst(): E | undefined {
return this.shift();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The unshift function adds a new node with the given value to the beginning of a doubly linked list.

@@ -247,3 +194,3 @@ * @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the

*/
unshift(value: E): void {
unshift(value: E): boolean {
const newNode = new DoublyLinkedListNode(value);

@@ -258,23 +205,7 @@ if (!this.head) {

}
this._length++;
this._size++;
return true;
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
* @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
* doubly linked list.
*/
addFirst(value: E): void {
this.unshift(value);
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.

@@ -288,34 +219,2 @@ * Space Complexity: O(1)

*
* The `getFirst` function returns the first node in a doubly linked list, or undefined if the list is empty.
* @returns The method `getFirst()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
*/
getFirst(): E | undefined {
return this.head?.value;
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `getLast` function returns the last node in a doubly linked list, or undefined if the list is empty.
* @returns The method `getLast()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
*/
getLast(): E | undefined {
return this.tail?.value;
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `getAt` function returns the value at a specified index in a linked list, or undefined if the index is out of bounds.

@@ -328,3 +227,3 @@ * @param {number} index - The index parameter is a number that represents the position of the element we want to

getAt(index: number): E | undefined {
if (index < 0 || index >= this.length) return undefined;
if (index < 0 || index >= this.size) return undefined;
let current = this.head;

@@ -354,3 +253,3 @@ for (let i = 0; i < index; i++) {

getNodeAt(index: number): DoublyLinkedListNode<E> | undefined {
if (index < 0 || index >= this.length) return undefined;
if (index < 0 || index >= this.size) return undefined;
let current = this.head;

@@ -408,4 +307,4 @@ for (let i = 0; i < index; i++) {

*/
insertAt(index: number, value: E): boolean {
if (index < 0 || index > this.length) return false;
addAt(index: number, value: E): boolean {
if (index < 0 || index > this.size) return false;
if (index === 0) {

@@ -415,3 +314,3 @@ this.unshift(value);

}
if (index === this.length) {
if (index === this.size) {
this.push(value);

@@ -428,3 +327,3 @@ return true;

nextNode!.prev = newNode;
this._length++;
this._size++;
return true;

@@ -442,3 +341,3 @@ }

*
* The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
* The `addBefore` function inserts a new value before an existing value or node in a doubly linked list.
* @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list

@@ -452,3 +351,3 @@ * before which the new value will be inserted. It can be either the value of the existing node or the existing node

*/
insertBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean {
addBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean {
let existingNode;

@@ -473,3 +372,3 @@

}
this._length++;
this._size++;
return true;

@@ -490,3 +389,3 @@ }

*
* The `insertAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* The `addAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* @param {E | DoublyLinkedListNode<E>} existingValueOrNode - The existing value or node in the doubly linked list

@@ -499,3 +398,3 @@ * after which the new value will be inserted. It can be either the value of the existing node or the existing node

*/
insertAfter(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean {
addAfter(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean {
let existingNode;

@@ -520,3 +419,3 @@

}
this._length++;
this._size++;
return true;

@@ -543,6 +442,12 @@ }

*/
deleteAt(index: number): E | undefined {
if (index < 0 || index >= this.length) return undefined;
if (index === 0) return this.shift();
if (index === this.length - 1) return this.pop();
deleteAt(index: number): boolean {
if (index < 0 || index >= this.size) return false;
if (index === 0) {
this.shift();
return true;
}
if (index === this.size - 1) {
this.pop();
return true;
}

@@ -554,4 +459,4 @@ const removedNode = this.getNodeAt(index);

nextNode!.prev = prevNode;
this._length--;
return removedNode!.value;
this._size--;
return true;
}

@@ -593,3 +498,3 @@

nextNode!.prev = prevNode;
this._length--;
this._size--;
}

@@ -602,11 +507,11 @@ return true;

/**
* The function checks if a variable has a length greater than zero and returns a boolean value.
* The function checks if a variable has a size greater than zero and returns a boolean value.
* @returns A boolean value is being returned.
*/
isEmpty(): boolean {
return this.length === 0;
return this.size === 0;
}
/**
* The `clear` function resets the linked list by setting the head, tail, and length to undefined and 0 respectively.
* The `clear` function resets the linked list by setting the head, tail, and size to undefined and 0 respectively.
*/

@@ -616,3 +521,3 @@ clear(): void {

this._tail = undefined;
this._length = 0;
this._size = 0;
}

@@ -712,3 +617,3 @@

*/
reverse(): void {
reverse(): this {
let current = this.head;

@@ -721,2 +626,3 @@ [this._head, this._tail] = [this.tail, this.head];

}
return this;
}

@@ -836,11 +742,101 @@

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addLast function adds a new node with the given value to the end of the doubly linked list.
* @param {E} value - The value to be added to the linked list.
*/
addLast(value: E): boolean {
return this.push(value);
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pollLast()` function removes and returns the value of the last node in a doubly linked list.
* @returns The method is returning the value of the removed node (removedNode.value) if the list is not empty. If the
* list is empty, it returns undefined.
*/
pollLast(): E | undefined {
return this.pop();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `pollFirst()` function removes and returns the value of the first node in a doubly linked list.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
*/
pollFirst(): E | undefined {
return this.shift();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The addFirst function adds a new node with the given value to the beginning of a doubly linked list.
* @param {E} value - The `value` parameter represents the value of the new node that will be added to the beginning of the
* doubly linked list.
*/
addFirst(value: E): void {
this.unshift(value);
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(n)
* Space Complexity: O(1)
*/
print(): void {
console.log([...this]);
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `get first` function returns the first node in a doubly linked list, or undefined if the list is empty.
* @returns The method `get first()` returns the first node of the doubly linked list, or `undefined` if the list is empty.
*/
get first(): E | undefined {
return this.head?.value;
}
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(1)
*
* The `get last` function returns the last node in a doubly linked list, or undefined if the list is empty.
* @returns The method `get last()` returns the last node of the doubly linked list, or `undefined` if the list is empty.
*/
get last(): E | undefined {
return this.tail?.value;
}
/**
* The function returns an iterator that iterates over the values of a linked list.

@@ -847,0 +843,0 @@ */

@@ -34,3 +34,3 @@ /**

this._tail = undefined;
this._length = 0;
this._size = 0;
if (elements) {

@@ -54,6 +54,6 @@ for (const el of elements)

protected _length: number;
protected _size: number;
get length(): number {
return this._length;
get size(): number {
return this._size;
}

@@ -96,3 +96,3 @@

*/
push(value: E): void {
push(value: E): boolean {
const newNode = new SinglyLinkedListNode(value);

@@ -106,3 +106,4 @@ if (!this.head) {

}
this._length++;
this._size++;
return true;
}

@@ -123,4 +124,4 @@

*/
addLast(value: E): void {
this.push(value);
addLast(value: E): boolean {
return this.push(value);
}

@@ -148,3 +149,3 @@

this._tail = undefined;
this._length--;
this._size--;
return value;

@@ -160,3 +161,3 @@ }

this._tail = current;
this._length--;
this._size--;
return value;

@@ -199,3 +200,3 @@ }

this._head = this.head.next;
this._length--;
this._size--;
return removedNode.value;

@@ -233,3 +234,3 @@ }

*/
unshift(value: E): void {
unshift(value: E): boolean {
const newNode = new SinglyLinkedListNode(value);

@@ -243,3 +244,4 @@ if (!this.head) {

}
this._length++;
this._size++;
return true;
}

@@ -260,4 +262,4 @@

*/
addFirst(value: E): void {
this.unshift(value);
addFirst(value: E): boolean {
return this.unshift(value);
}

@@ -281,3 +283,3 @@

getAt(index: number): E | undefined {
if (index < 0 || index >= this.length) return undefined;
if (index < 0 || index >= this.size) return undefined;
let current = this.head;

@@ -328,6 +330,12 @@ for (let i = 0; i < index; i++) {

*/
deleteAt(index: number): E | undefined {
if (index < 0 || index >= this.length) return undefined;
if (index === 0) return this.shift();
if (index === this.length - 1) return this.pop();
deleteAt(index: number): boolean {
if (index < 0 || index >= this.size) return false;
if (index === 0) {
this.shift();
return true;
}
if (index === this.size - 1) {
this.pop();
return true;
}

@@ -337,4 +345,4 @@ const prevNode = this.getNodeAt(index - 1);

prevNode!.next = removedNode!.next;
this._length--;
return removedNode!.value;
this._size--;
return true;
}

@@ -357,3 +365,3 @@

*/
delete(valueOrNode: E | SinglyLinkedListNode<E> | undefined | undefined): boolean {
delete(valueOrNode: E | SinglyLinkedListNode<E> | undefined ): boolean {
if (!valueOrNode) return false;

@@ -382,3 +390,3 @@ let value: E;

}
this._length--;
this._size--;
return true;

@@ -402,3 +410,3 @@ }

*
* The `insertAt` function inserts a value at a specified index in a singly linked list.
* The `addAt` function inserts a value at a specified index in a singly linked list.
* @param {number} index - The index parameter represents the position at which the new value should be inserted in the

@@ -411,4 +419,4 @@ * linked list. It is of type number.

*/
insertAt(index: number, value: E): boolean {
if (index < 0 || index > this.length) return false;
addAt(index: number, value: E): boolean {
if (index < 0 || index > this.size) return false;
if (index === 0) {

@@ -418,3 +426,3 @@ this.unshift(value);

}
if (index === this.length) {
if (index === this.size) {
this.push(value);

@@ -428,3 +436,3 @@ return true;

prevNode!.next = newNode;
this._length++;
this._size++;
return true;

@@ -439,3 +447,3 @@ }

isEmpty(): boolean {
return this.length === 0;
return this.size === 0;
}

@@ -449,3 +457,3 @@

this._tail = undefined;
this._length = 0;
this._size = 0;
}

@@ -487,4 +495,4 @@

*/
reverse(): void {
if (!this.head || this.head === this.tail) return;
reverse(): this {
if (!this.head || this.head === this.tail) return this;

@@ -503,2 +511,3 @@ let prev: SinglyLinkedListNode<E> | undefined = undefined;

[this._head, this._tail] = [this.tail!, this.head!];
return this;
}

@@ -598,10 +607,10 @@

*
* The `insertBefore` function inserts a new value before an existing value in a singly linked list.
* The `addBefore` function inserts a new value before an existing value in a singly linked list.
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node that you want to insert the
* new value before. It can be either the value itself or a node containing the value in the linked list.
* @param {E} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
* @returns The method `insertBefore` returns a boolean value. It returns `true` if the new value was successfully
* @returns The method `addBefore` returns a boolean value. It returns `true` if the new value was successfully
* inserted before the existing value, and `false` otherwise.
*/
insertBefore(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean {
addBefore(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean {
if (!this.head) return false;

@@ -626,3 +635,3 @@

current.next = newNode;
this._length++;
this._size++;
return true;

@@ -645,3 +654,3 @@ }

*
* The `insertAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* The `addAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* @param {E | SinglyLinkedListNode<E>} existingValueOrNode - The existing value or node in the linked list after which

@@ -653,3 +662,3 @@ * the new value will be inserted. It can be either the value of the existing node or the existing node itself.

*/
insertAfter(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean {
addAfter(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean {
let existingNode: E | SinglyLinkedListNode<E> | undefined;

@@ -670,3 +679,3 @@

}
this._length++;
this._size++;
return true;

@@ -769,11 +778,2 @@ }

/**
* Time Complexity: O(n), where n is the number of elements in the linked list.
* Space Complexity: O(n)
*/
print(): void {
console.log([...this]);
}
protected* _getIterator(): IterableIterator<E> {

@@ -780,0 +780,0 @@ let current = this.head;

@@ -196,3 +196,3 @@ /**

*/
getFirst(): V | undefined {
get first(): V | undefined {
const firstNode = this.head.forward[0];

@@ -214,3 +214,3 @@ return firstNode ? firstNode.value : undefined;

*/
getLast(): V | undefined {
get last(): V | undefined {
let current = this.head;

@@ -217,0 +217,0 @@ for (let i = this.level - 1; i >= 0; i--) {

@@ -87,102 +87,2 @@ /**

/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*/
isEmpty() {
return this.size === 0;
}
/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(n) - In worst case, resizing doubles the array size.
*
* The addLast function adds an element to the end of an array.
* @param {E} element - The element parameter represents the element that you want to add to the end of the
* data structure.
*/
addLast(element: E): void {
this.push(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*/
/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*
* The function "pollLast" removes and returns the last element of an array.
* @returns The last element of the array is being returned.
*/
pollLast(): E | undefined {
return this.pop();
}
/**
* Time Complexity: O(1).
* Space Complexity: O(n) - Due to potential resizing.
*
* The "addFirst" function adds an element to the beginning of an array.
* @param {E} element - The parameter "element" represents the element that you want to add to the
* beginning of the data structure.
*/
addFirst(element: E): void {
this.unshift(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*
* The function "pollFirst" removes and returns the first element of an array.
* @returns The method `pollFirst()` is returning the first element of the array after removing it
* from the beginning. If the array is empty, it will return `undefined`.
*/
pollFirst(): E | undefined {
return this.shift();
}
/**
* The clear() function resets the state of the object by initializing all variables to their default
* values.
*/
clear() {
this._buckets = [new Array(this._bucketSize)];
this._bucketCount = 1;
this._bucketFirst = this._bucketLast = this._size = 0;
this._firstInBucket = this._lastInBucket = this._bucketSize >> 1;
}
/**
* The below function is a generator that yields elements from a collection one by one.
*/
* begin(): Generator<E> {
let index = 0;
while (index < this.size) {
yield this.getAt(index);
index++;
}
}
/**
* The function `reverseBegin()` is a generator that yields elements in reverse order starting from
* the last element.
*/
* reverseBegin(): Generator<E> {
let index = this.size - 1;
while (index >= 0) {
yield this.getAt(index);
index--;
}
}
/**
* Time Complexity - Amortized O(1) (possible reallocation)

@@ -201,3 +101,3 @@ * Space Complexity - O(n) (due to potential resizing).

*/
push(element: E) {
push(element: E): boolean {
if (this.size) {

@@ -220,3 +120,3 @@ if (this._lastInBucket < this._bucketSize - 1) {

this._buckets[this._bucketLast][this._lastInBucket] = element;
return this.size;
return true;
}

@@ -237,3 +137,3 @@

*/
pop() {
pop(): E | undefined {
if (this.size === 0) return;

@@ -271,3 +171,3 @@ const element = this._buckets[this._bucketLast][this._lastInBucket];

*/
unshift(element: E) {
unshift(element: E): boolean {
if (this.size) {

@@ -290,6 +190,5 @@ if (this._firstInBucket > 0) {

this._buckets[this._bucketFirst][this._firstInBucket] = element;
return this.size;
return true;
}
/**

@@ -309,3 +208,3 @@ * Time Complexity: O(1)

*/
shift() {
shift(): E | undefined {
if (this.size === 0) return;

@@ -328,4 +227,47 @@ const element = this._buckets[this._bucketFirst][this._firstInBucket];

/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*/
isEmpty(): boolean {
return this.size === 0;
}
/**
* The clear() function resets the state of the object by initializing all variables to their default
* values.
*/
clear(): void {
this._buckets = [new Array(this._bucketSize)];
this._bucketCount = 1;
this._bucketFirst = this._bucketLast = this._size = 0;
this._firstInBucket = this._lastInBucket = this._bucketSize >> 1;
}
/**
* The below function is a generator that yields elements from a collection one by one.
*/
* begin(): Generator<E> {
let index = 0;
while (index < this.size) {
yield this.getAt(index);
index++;
}
}
/**
* The function `reverseBegin()` is a generator that yields elements in reverse order starting from
* the last element.
*/
* reverseBegin(): Generator<E> {
let index = this.size - 1;
while (index >= 0) {
yield this.getAt(index);
index--;
}
}
/**
* Time Complexity: O(1)

@@ -370,3 +312,3 @@ * Space Complexity: O(1)

*/
setAt(pos: number, element: E) {
setAt(pos: number, element: E): boolean {
rangeCheck(pos, 0, this.size - 1);

@@ -378,2 +320,3 @@ const {

this._buckets[bucketIndex][indexInBucket] = element;
return true;
}

@@ -390,3 +333,3 @@

*
* The `insertAt` function inserts one or more elements at a specified position in an array-like data
* The `addAt` function inserts one or more elements at a specified position in an array-like data
* structure.

@@ -402,3 +345,3 @@ * @param {number} pos - The `pos` parameter represents the position at which the element(s) should

*/
insertAt(pos: number, element: E, num = 1) {
addAt(pos: number, element: E, num = 1): boolean {
const length = this.size;

@@ -419,3 +362,3 @@ rangeCheck(pos, 0, length);

}
return this.size;
return true;
}

@@ -438,3 +381,3 @@

*/
cut(pos: number) {
cut(pos: number): number {
if (pos < 0) {

@@ -470,3 +413,3 @@ this.clear();

*/
deleteAt(pos: number) {
deleteAt(pos: number): boolean {
rangeCheck(pos, 0, this.size - 1);

@@ -492,3 +435,3 @@ if (pos === 0) this.shift();

}
return this.size;
return true;
}

@@ -511,5 +454,5 @@

*/
delete(element: E) {
delete(element: E): boolean {
const size = this.size;
if (size === 0) return 0;
if (size === 0) return false;
let i = 0;

@@ -526,3 +469,3 @@ let index = 0;

this.cut(index - 1);
return this.size;
return true;
}

@@ -544,3 +487,3 @@

*/
reverse() {
reverse(): this {
this._buckets.reverse().forEach(function (bucket) {

@@ -570,5 +513,5 @@ bucket.reverse();

*/
unique() {
unique(): this {
if (this.size <= 1) {
return this.size;
return this;
}

@@ -585,3 +528,3 @@ let index = 1;

this.cut(index - 1);
return this.size;
return this;
}

@@ -602,5 +545,5 @@

* the elements in the sorted array.
* @returns The method is returning the sorted instance of the object on which the method is called.
* @returns Deque<E>
*/
sort(comparator?: (x: E, y: E) => number) {
sort(comparator?: (x: E, y: E) => number): this {
const arr: E[] = [];

@@ -631,3 +574,3 @@ for (let i = 0; i < this.size; ++i) {

*/
shrinkToFit() {
shrinkToFit(): void {
if (this.size === 0) return;

@@ -676,3 +619,3 @@ const newBuckets = [];

}
return undefined;
return;
}

@@ -718,7 +661,3 @@

toArray(): E[] {
const arr: E[] = [];
for (let i = 0; i < this.size; ++i) {
arr.push(this.getAt(i));
}
return arr;
return [...this];
}

@@ -786,11 +725,59 @@

/**
* Time Complexity: O(n)
* Space Complexity: O(n)
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
print(): void {
console.log([...this])
/**
* Time Complexity: O(1)
* Space Complexity: O(n) - In worst case, resizing doubles the array size.
*
* The addLast function adds an element to the end of an array.
* @param {E} element - The element parameter represents the element that you want to add to the end of the
* data structure.
*/
addLast(element: E): boolean {
return this.push(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*/
/**
* Time Complexity: O(1) - Removes the last element.
* Space Complexity: O(1) - Operates in-place.
*
* The function "pollLast" removes and returns the last element of an array.
* @returns The last element of the array is being returned.
*/
pollLast(): E | undefined {
return this.pop();
}
/**
* Time Complexity: O(1).
* Space Complexity: O(n) - Due to potential resizing.
*
* The "addFirst" function adds an element to the beginning of an array.
* @param {E} element - The parameter "element" represents the element that you want to add to the
* beginning of the data structure.
*/
addFirst(element: E): boolean {
return this.unshift(element);
}
/**
* Time Complexity: O(1) - Removes the first element.
* Space Complexity: O(1) - In-place operation.
*
* The function "pollFirst" removes and returns the first element of an array.
* @returns The method `pollFirst()` is returning the first element of the array after removing it
* from the beginning. If the array is empty, it will return `undefined`.
*/
pollFirst(): E | undefined {
return this.shift();
}
/**
* Time Complexity: O(n)

@@ -802,3 +789,3 @@ * Space Complexity: O(1)

*/
protected* _getIterator() {
protected* _getIterator(): IterableIterator<E> {
for (let i = 0; i < this.size; ++i) {

@@ -805,0 +792,0 @@ yield this.getAt(i);

@@ -77,5 +77,5 @@ /**

*/
push(element: E): Queue<E> {
push(element: E): boolean {
this.nodes.push(element);
return this;
return true;
}

@@ -99,3 +99,3 @@

const first = this.getFirst();
const first = this.first;
this._offset += 1;

@@ -121,7 +121,7 @@

*
* The `getFirst` function returns the first element of the array `_nodes` if it exists, otherwise it returns `undefined`.
* @returns The `getFirst()` method returns the first element of the data structure, represented by the `_nodes` array at
* The `first` function returns the first element of the array `_nodes` if it exists, otherwise it returns `undefined`.
* @returns The `get first()` method returns the first element of the data structure, represented by the `_nodes` array at
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
*/
getFirst(): E | undefined {
get first(): E | undefined {
return this.size > 0 ? this.nodes[this.offset] : undefined;

@@ -144,3 +144,3 @@ }

peek(): E | undefined {
return this.getFirst();
return this.first;
}

@@ -157,7 +157,7 @@

*
* The `getLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `getLast()` returns the last element of the `_nodes` array if the array is not empty. If the
* The `last` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `get last()` returns the last element of the `_nodes` array if the array is not empty. If the
* array is empty, it returns `undefined`.
*/
getLast(): E | undefined {
get last(): E | undefined {
return this.size > 0 ? this.nodes[this.nodes.length - 1] : undefined;

@@ -180,3 +180,3 @@ }

peekLast(): E | undefined {
return this.getLast();
return this.last;
}

@@ -196,3 +196,3 @@

*/
enqueue(value: E) {
enqueue(value: E): boolean {
return this.push(value);

@@ -288,6 +288,2 @@ }

print(): void {
console.log([...this]);
}
/**

@@ -359,3 +355,3 @@ * Time Complexity: O(n)

protected* _getIterator() {
protected* _getIterator(): IterableIterator<E> {
for (const item of this.nodes) {

@@ -378,4 +374,4 @@ yield item;

*/
enqueue(value: E) {
this.push(value);
enqueue(value: E): boolean {
return this.push(value);
}

@@ -392,6 +388,6 @@

/**
* The `getFirst` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `getFirst()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
* The `get first` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `get first()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
*/
getFirst(): E | undefined {
get first(): E | undefined {
return this.head?.value;

@@ -405,4 +401,4 @@ }

peek(): E | undefined {
return this.getFirst();
return this.first;
}
}

@@ -107,5 +107,5 @@ /**

*/
push(element: E): Stack<E> {
push(element: E): boolean {
this.elements.push(element);
return this;
return true;
}

@@ -127,3 +127,3 @@

pop(): E | undefined {
if (this.isEmpty()) return undefined;
if (this.isEmpty()) return;

@@ -233,6 +233,2 @@ return this.elements.pop();

print(): void {
console.log([...this]);
}
/**

@@ -242,3 +238,3 @@ * Custom iterator for the Stack class.

*/
protected* _getIterator() {
protected* _getIterator(): IterableIterator<E> {
for (let i = 0; i < this.elements.length; i++) {

@@ -245,0 +241,0 @@ yield this.elements[i];

@@ -141,3 +141,3 @@ /**

*/
delete(word: string) {
delete(word: string): boolean {
word = this._caseProcess(word);

@@ -188,3 +188,3 @@ let isDeleted = false;

*/
getHeight() {
getHeight(): number {
const beginRoot = this.root;

@@ -376,8 +376,8 @@ let maxDepth = 0;

*/
filter(predicate: ElementCallback<string, boolean>, thisArg?: any): string[] {
const results: string[] = [];
filter(predicate: ElementCallback<string, boolean>, thisArg?: any): Trie {
const results: Trie = new Trie();
let index = 0;
for (const word of this) {
if (predicate.call(thisArg, word, index, this)) {
results.push(word);
results.add(word);
}

@@ -417,6 +417,2 @@ index++;

print() {
console.log([...this]);
}
protected* _getIterator(): IterableIterator<string> {

@@ -423,0 +419,0 @@ function* _dfs(node: TrieNode, path: string): IterableIterator<string> {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc