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.50.4 to 1.50.5

18

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

@@ -7,2 +7,3 @@ import { ElementCallback, EntryCallback, ReduceElementCallback, ReduceEntryCallback } from '../../types';

*/
abstract get size(): number;
/**

@@ -98,2 +99,6 @@ * Time Complexity: O(n)

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -179,6 +184,2 @@ * The `forEach` function iterates over each key-value pair in a collection and executes a callback

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -211,2 +212,3 @@ * The `reduce` function iterates over key-value pairs and applies a callback function to each pair,

export declare abstract class IterableElementBase<E = any, C = any> {
abstract get size(): number;
/**

@@ -263,2 +265,6 @@ * Time Complexity: O(n)

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -318,6 +324,2 @@ * The "some" function checks if at least one element in a collection satisfies a given predicate.

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -324,0 +326,0 @@ * The function checks if a given element exists in a collection.

@@ -8,6 +8,2 @@ "use strict";

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -130,2 +126,6 @@ * The function is an implementation of the Symbol.iterator method that returns an iterable iterator.

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -245,6 +245,2 @@ * The `forEach` function iterates over each key-value pair in a collection and executes a callback

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -347,2 +343,6 @@ * The `reduce` function iterates over key-value pairs and applies a callback function to each pair,

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -422,6 +422,2 @@ * The "some" function checks if at least one element in a collection satisfies a given predicate.

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -428,0 +424,0 @@ * The function checks if a given element exists in a collection.

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

set vertexMap(v: Map<VertexKey, VO>);
get size(): number;
/**

@@ -46,0 +47,0 @@ * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.

@@ -53,2 +53,5 @@ "use strict";

}
get size() {
return this._vertexMap.size;
}
/**

@@ -55,0 +58,0 @@ * Time Complexity: O(1) - Constant time for Map lookup.

@@ -134,9 +134,8 @@ /**

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The push 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.
* The push function adds a new element to the end of a doubly linked list.
* @param {E} element - The "element" parameter represents the value that you want to add to the
* doubly linked list.
* @returns The `push` method is returning a boolean value, `true`.
*/
push(value: E): boolean;
push(element: E): boolean;
/**

@@ -147,8 +146,4 @@ * Time 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.
* @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.
* The `pop()` function removes and returns the value of the last element in a linked list.
* @returns The method is returning the value of the removed node.
*/

@@ -161,8 +156,4 @@ pop(): E | undefined;

/**
* 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.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
* The `shift()` function removes and returns the value of the first element in a doubly linked list.
* @returns The value of the removed node.
*/

@@ -175,10 +166,8 @@ shift(): E | undefined;

/**
* 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.
* @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.
* The unshift function adds a new element to the beginning of a doubly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the beginning of the doubly linked list.
* @returns The `unshift` method is returning a boolean value, `true`.
*/
unshift(value: E): boolean;
unshift(element: E): boolean;
/**

@@ -457,53 +446,2 @@ * Time Complexity: O(n)

/**
* 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;
/**
* The function returns an iterator that iterates over the values of a linked list.

@@ -510,0 +448,0 @@ */

@@ -164,10 +164,9 @@ "use strict";

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The push 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.
* The push function adds a new element to the end of a doubly linked list.
* @param {E} element - The "element" parameter represents the value that you want to add to the
* doubly linked list.
* @returns The `push` method is returning a boolean value, `true`.
*/
push(value) {
const newNode = new DoublyLinkedListNode(value);
push(element) {
const newNode = new DoublyLinkedListNode(element);
if (!this.head) {

@@ -190,8 +189,4 @@ this._head = newNode;

/**
* 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.
* @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.
* The `pop()` function removes and returns the value of the last element in a linked list.
* @returns The method is returning the value of the removed node.
*/

@@ -218,8 +213,4 @@ pop() {

/**
* 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.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
* The `shift()` function removes and returns the value of the first element in a doubly linked list.
* @returns The value of the removed node.
*/

@@ -246,11 +237,9 @@ shift() {

/**
* 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.
* @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.
* The unshift function adds a new element to the beginning of a doubly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the beginning of the doubly linked list.
* @returns The `unshift` method is returning a boolean value, `true`.
*/
unshift(value) {
const newNode = new DoublyLinkedListNode(value);
unshift(element) {
const newNode = new DoublyLinkedListNode(element);
if (!this.head) {

@@ -746,61 +735,2 @@ this._head = newNode;

/**
* 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);
}
/**
* The function returns an iterator that iterates over the values of a linked list.

@@ -807,0 +737,0 @@ */

@@ -63,2 +63,14 @@ /**

get tail(): SinglyLinkedListNode<E> | undefined;
/**
* The above function returns the value of the first element in a linked list, or undefined if the
* list is empty.
* @returns The value of the first node in the linked list, or undefined if the linked list is empty.
*/
get first(): E | undefined;
/**
* The function returns the value of the last element in a linked list, or undefined if the list is
* empty.
* @returns The value of the last node in the linked list, or undefined if the linked list is empty.
*/
get last(): E | undefined;
protected _size: number;

@@ -89,4 +101,2 @@ /**

* Space Complexity: O(1)
* Constant time, as it involves basic pointer adjustments.
* Constant space, as it only creates a new node.
*/

@@ -97,21 +107,9 @@ /**

*
* The `push` function adds a new node with the given value to the end of a singly linked list.
* @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
* any type (E) as specified in the generic type declaration of the class or function.
* The push function adds a new element to the end of a singly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the linked list.
* @returns The `push` method is returning a boolean value, `true`.
*/
push(value: E): boolean;
push(element: E): boolean;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `push` function adds a new node with the given value to the end of a singly linked list.
* @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
* any type (E) as specified in the generic type declaration of the class or function.
*/
addLast(value: E): boolean;
/**
* Time Complexity: O(n)

@@ -125,23 +123,8 @@ * Space Complexity: O(1)

*
* The `pop()` function removes and returns the value of the last element in a linked list, updating the head and tail
* pointers accordingly.
* @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
* the linked list is empty, it returns `undefined`.
* The `pop` function removes and returns the value of the last element in a linked list.
* @returns The method is returning the value of the element that is being popped from the end of the
* list.
*/
pop(): E | undefined;
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*
* The `pollLast()` function removes and returns the value of the last element in a linked list, updating the head and tail
* pointers accordingly.
* @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
* the linked list is empty, it returns `undefined`.
*/
pollLast(): E | undefined;
/**
* Time Complexity: O(1)

@@ -154,4 +137,4 @@ * Space Complexity: O(1)

*
* The `shift()` function removes and returns the value of the first node in a linked list.
* @returns The value of the node that is being removed from the beginning of the linked list.
* The `shift()` function removes and returns the value of the first element in a linked list.
* @returns The value of the removed node.
*/

@@ -167,36 +150,11 @@ shift(): E | undefined;

*
* The `pollFirst()` function removes and returns the value of the first node in a linked list.
* @returns The value of the node that is being removed from the beginning of the linked list.
* The unshift function adds a new element to the beginning of a singly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the beginning of the singly linked list.
* @returns The `unshift` method is returning a boolean value, `true`.
*/
pollFirst(): E | undefined;
unshift(element: E): boolean;
/**
* 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 singly linked list.
* @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
* linked list.
*/
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 singly linked list.
* @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
* linked list.
*/
addFirst(value: E): boolean;
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
* Linear time, where n is the index, as it may need to traverse the list to find the desired node.
*/

@@ -203,0 +161,0 @@ /**

@@ -78,2 +78,20 @@ "use strict";

/**
* The above function returns the value of the first element in a linked list, or undefined if the
* list is empty.
* @returns The value of the first node in the linked list, or undefined if the linked list is empty.
*/
get first() {
var _a;
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* The function returns the value of the last element in a linked list, or undefined if the list is
* empty.
* @returns The value of the last node in the linked list, or undefined if the linked list is empty.
*/
get last() {
var _a;
return (_a = this.tail) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* The function returns the size of an object.

@@ -110,4 +128,2 @@ * @returns The size of the object, which is a number.

* Space Complexity: O(1)
* Constant time, as it involves basic pointer adjustments.
* Constant space, as it only creates a new node.
*/

@@ -118,8 +134,9 @@ /**

*
* The `push` function adds a new node with the given value to the end of a singly linked list.
* @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
* any type (E) as specified in the generic type declaration of the class or function.
* The push function adds a new element to the end of a singly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the linked list.
* @returns The `push` method is returning a boolean value, `true`.
*/
push(value) {
const newNode = new SinglyLinkedListNode(value);
push(element) {
const newNode = new SinglyLinkedListNode(element);
if (!this.head) {

@@ -137,17 +154,2 @@ this._head = newNode;

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `push` function adds a new node with the given value to the end of a singly linked list.
* @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
* any type (E) as specified in the generic type declaration of the class or function.
*/
addLast(value) {
return this.push(value);
}
/**
* Time Complexity: O(n)

@@ -161,6 +163,5 @@ * Space Complexity: O(1)

*
* The `pop()` function removes and returns the value of the last element in a linked list, updating the head and tail
* pointers accordingly.
* @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
* the linked list is empty, it returns `undefined`.
* The `pop` function removes and returns the value of the last element in a linked list.
* @returns The method is returning the value of the element that is being popped from the end of the
* list.
*/

@@ -188,18 +189,2 @@ pop() {

/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*
* The `pollLast()` function removes and returns the value of the last element in a linked list, updating the head and tail
* pointers accordingly.
* @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
* the linked list is empty, it returns `undefined`.
*/
pollLast() {
return this.pop();
}
/**
* Time Complexity: O(1)

@@ -212,4 +197,4 @@ * Space Complexity: O(1)

*
* The `shift()` function removes and returns the value of the first node in a linked list.
* @returns The value of the node that is being removed from the beginning of the linked list.
* The `shift()` function removes and returns the value of the first element in a linked list.
* @returns The value of the removed node.
*/

@@ -232,22 +217,9 @@ shift() {

*
* The `pollFirst()` function removes and returns the value of the first node in a linked list.
* @returns The value of the node that is being removed from the beginning of the linked list.
* The unshift function adds a new element to the beginning of a singly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the beginning of the singly linked list.
* @returns The `unshift` method is returning a boolean value, `true`.
*/
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 singly linked list.
* @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
* linked list.
*/
unshift(value) {
const newNode = new SinglyLinkedListNode(value);
unshift(element) {
const newNode = new SinglyLinkedListNode(element);
if (!this.head) {

@@ -265,20 +237,4 @@ this._head = newNode;

/**
* 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 singly linked list.
* @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
* linked list.
*/
addFirst(value) {
return this.unshift(value);
}
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
* Linear time, where n is the index, as it may need to traverse the list to find the desired node.
*/

@@ -285,0 +241,0 @@ /**

@@ -436,55 +436,2 @@ /**

/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*
* 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)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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(1)
* /
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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)
* Space Complexity: O(1)
* /
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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)

@@ -491,0 +438,0 @@ * Space Complexity: O(1)

@@ -771,63 +771,2 @@ "use strict";

/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*
* 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)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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(1)
* /
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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)
* Space Complexity: O(1)
* /
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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)

@@ -834,0 +773,0 @@ * Space Complexity: O(1)

@@ -131,52 +131,2 @@ /**

*
* The `peek` function returns the first element of the array `_elements` if it exists, otherwise it returns `undefined`.
* @returns The `peek()` method returns the first element of the data structure, represented by the `_elements` array at
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
*/
peek(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `peekLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `peekLast()` returns the last element of the `_elements` array if the array is not empty. If the
* array is empty, it returns `undefined`.
*/
peekLast(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The enqueue function adds a value to the end of a queue.
* @param {E} value - The value parameter represents the value that you want to add to the queue.
*/
enqueue(value: E): boolean;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.
* @returns The method is returning a value of type E or undefined.
*/
dequeue(): E | undefined;
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* @param index

@@ -293,22 +243,2 @@ */

/**
* 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`.
*/
get first(): E | undefined;
/**
* The enqueue function adds a value to the end of an array.
* @param {E} value - The value parameter represents the value that you want to add to the queue.
*/
enqueue(value: E): boolean;
/**
* The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.
* @returns The method is returning the element at the front of the queue, or undefined if the queue is empty.
*/
dequeue(): E | undefined;
/**
* The `peek` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `peek()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
*/
peek(): E | undefined;
/**
* Time Complexity: O(n)

@@ -315,0 +245,0 @@ * Space Complexity: O(n)

@@ -167,60 +167,2 @@ "use strict";

*
* The `peek` function returns the first element of the array `_elements` if it exists, otherwise it returns `undefined`.
* @returns The `peek()` method returns the first element of the data structure, represented by the `_elements` array at
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
*/
peek() {
return this.first;
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `peekLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `peekLast()` returns the last element of the `_elements` array if the array is not empty. If the
* array is empty, it returns `undefined`.
*/
peekLast() {
return this.last;
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The enqueue function adds a value to the end of a queue.
* @param {E} value - The value parameter represents the value that you want to add to the queue.
*/
enqueue(value) {
return this.push(value);
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.
* @returns The method is returning a value of type E or undefined.
*/
dequeue() {
return this.shift();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* @param index

@@ -371,31 +313,2 @@ */

/**
* 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`.
*/
get first() {
var _a;
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
}
/**
* The enqueue function adds a value to the end of an array.
* @param {E} value - The value parameter represents the value that you want to add to the queue.
*/
enqueue(value) {
return this.push(value);
}
/**
* The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.
* @returns The method is returning the element at the front of the queue, or undefined if the queue is empty.
*/
dequeue() {
return this.shift();
}
/**
* The `peek` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `peek()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
*/
peek() {
return this.first;
}
/**
* Time Complexity: O(n)

@@ -402,0 +315,0 @@ * Space Complexity: O(n)

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

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

@@ -9,2 +9,4 @@ import { ElementCallback, EntryCallback, ReduceElementCallback, ReduceEntryCallback } from '../../types';

abstract get size(): number;
/**

@@ -133,5 +135,10 @@ * Time Complexity: O(n)

*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -256,7 +263,2 @@ * The `forEach` function iterates over each key-value pair in a collection and executes a callback

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -307,2 +309,4 @@ * The `reduce` function iterates over key-value pairs and applies a callback function to each pair,

export abstract class IterableElementBase<E = any, C = any> {
abstract get size(): number;
/**

@@ -373,5 +377,10 @@ * Time Complexity: O(n)

*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -456,7 +465,2 @@ * The "some" function checks if at least one element in a collection satisfies a given predicate.

* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*

@@ -463,0 +467,0 @@ * The function checks if a given element exists in a collection.

@@ -85,2 +85,6 @@ /**

get size(): number {
return this._vertexMap.size;
}
/**

@@ -87,0 +91,0 @@ * In TypeScript, a subclass inherits the interface implementation of its parent class, without needing to implement the same interface again in the subclass. This behavior differs from Java's approach. In Java, if a parent class implements an interface, the subclass needs to explicitly implement the same interface, even if the parent class has already implemented it.

@@ -203,3 +203,3 @@ /**

*/
has(element: E): boolean {
override has(element: E): boolean {
return this.elements.includes(element);

@@ -206,0 +206,0 @@ }

@@ -197,10 +197,9 @@ /**

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The push 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.
* The push function adds a new element to the end of a doubly linked list.
* @param {E} element - The "element" parameter represents the value that you want to add to the
* doubly linked list.
* @returns The `push` method is returning a boolean value, `true`.
*/
push(value: E): boolean {
const newNode = new DoublyLinkedListNode(value);
push(element: E): boolean {
const newNode = new DoublyLinkedListNode(element);
if (!this.head) {

@@ -224,8 +223,4 @@ this._head = newNode;

/**
* 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.
* @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.
* The `pop()` function removes and returns the value of the last element in a linked list.
* @returns The method is returning the value of the removed node.
*/

@@ -252,8 +247,4 @@ pop(): E | undefined {

/**
* 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.
* @returns The method `shift()` returns the value of the node that is removed from the beginning of the doubly linked
* list.
* The `shift()` function removes and returns the value of the first element in a doubly linked list.
* @returns The value of the removed node.
*/

@@ -280,11 +271,9 @@ shift(): E | undefined {

/**
* 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.
* @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.
* The unshift function adds a new element to the beginning of a doubly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the beginning of the doubly linked list.
* @returns The `unshift` method is returning a boolean value, `true`.
*/
unshift(value: E): boolean {
const newNode = new DoublyLinkedListNode(value);
unshift(element: E): boolean {
const newNode = new DoublyLinkedListNode(element);
if (!this.head) {

@@ -819,69 +808,2 @@ this._head = newNode;

/**
* 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);
}
/**
* The function returns an iterator that iterates over the values of a linked list.

@@ -888,0 +810,0 @@ */

@@ -96,2 +96,20 @@ /**

/**
* The above function returns the value of the first element in a linked list, or undefined if the
* list is empty.
* @returns The value of the first node in the linked list, or undefined if the linked list is empty.
*/
get first(): E | undefined {
return this.head?.value;
}
/**
* The function returns the value of the last element in a linked list, or undefined if the list is
* empty.
* @returns The value of the last node in the linked list, or undefined if the linked list is empty.
*/
get last(): E | undefined {
return this.tail?.value;
}
protected _size: number = 0;

@@ -134,4 +152,2 @@

* Space Complexity: O(1)
* Constant time, as it involves basic pointer adjustments.
* Constant space, as it only creates a new node.
*/

@@ -143,8 +159,9 @@

*
* The `push` function adds a new node with the given value to the end of a singly linked list.
* @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
* any type (E) as specified in the generic type declaration of the class or function.
* The push function adds a new element to the end of a singly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the linked list.
* @returns The `push` method is returning a boolean value, `true`.
*/
push(value: E): boolean {
const newNode = new SinglyLinkedListNode(value);
push(element: E): boolean {
const newNode = new SinglyLinkedListNode(element);
if (!this.head) {

@@ -162,19 +179,2 @@ this._head = newNode;

/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `push` function adds a new node with the given value to the end of a singly linked list.
* @param {E} value - The "value" parameter represents the value that you want to add to the linked list. It can be of
* any type (E) as specified in the generic type declaration of the class or function.
*/
addLast(value: E): boolean {
return this.push(value);
}
/**
* Time Complexity: O(n)

@@ -189,6 +189,5 @@ * Space Complexity: O(1)

*
* The `pop()` function removes and returns the value of the last element in a linked list, updating the head and tail
* pointers accordingly.
* @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
* the linked list is empty, it returns `undefined`.
* The `pop` function removes and returns the value of the last element in a linked list.
* @returns The method is returning the value of the element that is being popped from the end of the
* list.
*/

@@ -217,20 +216,2 @@ pop(): E | undefined {

/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
*
* The `pollLast()` function removes and returns the value of the last element in a linked list, updating the head and tail
* pointers accordingly.
* @returns The method `pop()` returns the value of the node that is being removed from the end of the linked list. If
* the linked list is empty, it returns `undefined`.
*/
pollLast(): E | undefined {
return this.pop();
}
/**
* Time Complexity: O(1)

@@ -244,4 +225,4 @@ * Space Complexity: O(1)

*
* The `shift()` function removes and returns the value of the first node in a linked list.
* @returns The value of the node that is being removed from the beginning of the linked list.
* The `shift()` function removes and returns the value of the first element in a linked list.
* @returns The value of the removed node.
*/

@@ -265,24 +246,9 @@ shift(): E | undefined {

*
* The `pollFirst()` function removes and returns the value of the first node in a linked list.
* @returns The value of the node that is being removed from the beginning of the linked list.
* The unshift function adds a new element to the beginning of a singly linked list.
* @param {E} element - The "element" parameter represents the value of the element that you want to
* add to the beginning of the singly linked list.
* @returns The `unshift` method is returning a boolean value, `true`.
*/
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 singly linked list.
* @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
* linked list.
*/
unshift(value: E): boolean {
const newNode = new SinglyLinkedListNode(value);
unshift(element: E): boolean {
const newNode = new SinglyLinkedListNode(element);
if (!this.head) {

@@ -300,22 +266,4 @@ this._head = newNode;

/**
* 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 singly linked list.
* @param {E} value - The parameter "value" represents the value of the new node that will be added to the beginning of the
* linked list.
*/
addFirst(value: E): boolean {
return this.unshift(value);
}
/**
* Time Complexity: O(n)
* Space Complexity: O(1)
* Linear time, where n is the index, as it may need to traverse the list to find the desired node.
*/

@@ -322,0 +270,0 @@

@@ -815,69 +815,2 @@ /**

/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*/
/**
* Time Complexity: Amortized O(1) - Similar to push, resizing leads to O(n).
* Space Complexity: O(n) - Due to potential resizing.
*
* 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)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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(1)
* /
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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)
* Space Complexity: O(1)
* /
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* 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)

@@ -884,0 +817,0 @@ * Space Complexity: O(1)

@@ -190,68 +190,2 @@ /**

*
* The `peek` function returns the first element of the array `_elements` if it exists, otherwise it returns `undefined`.
* @returns The `peek()` method returns the first element of the data structure, represented by the `_elements` array at
* the `_offset` index. If the data structure is empty (size is 0), it returns `undefined`.
*/
peek(): E | undefined {
return this.first;
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `peekLast` function returns the last element in an array-like data structure, or undefined if the structure is empty.
* @returns The method `peekLast()` returns the last element of the `_elements` array if the array is not empty. If the
* array is empty, it returns `undefined`.
*/
peekLast(): E | undefined {
return this.last;
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The enqueue function adds a value to the end of a queue.
* @param {E} value - The value parameter represents the value that you want to add to the queue.
*/
enqueue(value: E): boolean {
return this.push(value);
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.
* @returns The method is returning a value of type E or undefined.
*/
dequeue(): E | undefined {
return this.shift();
}
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*/
/**
* Time Complexity: O(1)
* Space Complexity: O(1)
*
* @param index

@@ -416,34 +350,2 @@ */

/**
* 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`.
*/
get first(): E | undefined {
return this.head?.value;
}
/**
* The enqueue function adds a value to the end of an array.
* @param {E} value - The value parameter represents the value that you want to add to the queue.
*/
enqueue(value: E): boolean {
return this.push(value);
}
/**
* The `dequeue` function removes and returns the first element from a queue, or returns undefined if the queue is empty.
* @returns The method is returning the element at the front of the queue, or undefined if the queue is empty.
*/
dequeue(): E | undefined {
return this.shift();
}
/**
* The `peek` function returns the value of the head node in a linked list, or `undefined` if the list is empty.
* @returns The `peek()` method is returning the value of the `head` node if it exists, otherwise it returns `undefined`.
*/
peek(): E | undefined {
return this.first;
}
/**
* Time Complexity: O(n)

@@ -450,0 +352,0 @@ * Space Complexity: O(n)

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