Socket
Socket
Sign inDemoInstall

data-structure-typed

Package Overview
Dependencies
Maintainers
1
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-structure-typed - npm Package Compare versions

Comparing version 1.17.0 to 1.17.3

docs/classes/SkipLinkedList.html

33

dist/data-structures/linked-list/doubly-linked-list.d.ts

@@ -104,3 +104,3 @@ /**

*/
insert(index: number, val: T): boolean;
insertAt(index: number, val: T): boolean;
/**

@@ -114,10 +114,5 @@ * The `deleteAt` function removes an element at a specified index from a linked list and returns the removed element.

deleteAt(index: number): T | null;
delete(valOrNode: T): boolean;
delete(valOrNode: DoublyLinkedListNode<T>): boolean;
/**
* The `delete` function removes a node with a specific value from a doubly linked list.
* @param {T} val - The `val` parameter represents the value that you want to delete from the linked list.
* @returns The `delete` method returns a boolean value. It returns `true` if the value `val` is found and deleted from
* the linked list, and `false` if the value is not found in the linked list.
*/
delete(val: T): boolean;
/**
* The `toArray` function converts a linked list into an array.

@@ -200,20 +195,6 @@ * @returns The `toArray()` method is returning an array of type `T[]`.

reduce<U>(callback: (accumulator: U, val: T) => U, initialValue: U): U;
/**
* The function inserts a new value after an existing value in a doubly linked list.
* @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
* @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert after
* the existing node.
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
* existing value is not found in the linked list.
*/
insertAfter(existingValue: T, newValue: T): boolean;
/**
* The `insertBefore` function inserts a new value before an existing value in a doubly linked list.
* @param {T} existingValue - The existing value is the value of the node that you want to insert the new value before.
* @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert before
* the existing node.
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
* existing value is not found in the linked list.
*/
insertBefore(existingValue: T, newValue: T): boolean;
insertAfter(existingValueOrNode: T, newValue: T): boolean;
insertAfter(existingValueOrNode: DoublyLinkedListNode<T>, newValue: T): boolean;
insertBefore(existingValueOrNode: T, newValue: T): boolean;
insertBefore(existingValueOrNode: DoublyLinkedListNode<T>, newValue: T): boolean;
}

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

*/
DoublyLinkedList.prototype.insert = function (index, val) {
DoublyLinkedList.prototype.insertAt = function (index, val) {
if (index < 0 || index > this.length)

@@ -327,27 +327,31 @@ return false;

/**
* The `delete` function removes a node with a specific value from a doubly linked list.
* @param {T} val - The `val` parameter represents the value that you want to delete from the linked list.
* @returns The `delete` method returns a boolean value. It returns `true` if the value `val` is found and deleted from
* the linked list, and `false` if the value is not found in the linked list.
* The `delete` function removes a node from a doubly linked list based on either the node itself or its value.
* @param {T | DoublyLinkedListNode<T>} valOrNode - The `valOrNode` parameter can accept either a value of type `T` or
* a `DoublyLinkedListNode<T>` object.
* @returns The `delete` method returns a boolean value. It returns `true` if the value or node was successfully
* deleted from the doubly linked list, and `false` if the value or node was not found in the list.
*/
DoublyLinkedList.prototype.delete = function (val) {
var current = this.head;
while (current) {
if (current.val === val) {
if (current === this.head) {
this.shift();
}
else if (current === this.tail) {
this.pop();
}
else {
var prevNode = current.prev;
var nextNode = current.next;
prevNode.next = nextNode;
nextNode.prev = prevNode;
this.length--;
}
return true;
DoublyLinkedList.prototype.delete = function (valOrNode) {
var node;
if (valOrNode instanceof (DoublyLinkedListNode)) {
node = valOrNode;
}
else {
node = this.findNode(valOrNode);
}
if (node) {
if (node === this.head) {
this.shift();
}
current = current.next;
else if (node === this.tail) {
this.pop();
}
else {
var prevNode = node.prev;
var nextNode = node.next;
prevNode.next = nextNode;
nextNode.prev = prevNode;
this.length--;
}
return true;
}

@@ -527,11 +531,18 @@ return false;

/**
* The function inserts a new value after an existing value in a doubly linked list.
* @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
* @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert after
* the existing node.
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
* existing value is not found in the linked list.
* The `insertAfter` function inserts a new node with a given value after an existing node in a doubly linked list.
* @param {T | DoublyLinkedListNode<T>} existingValueOrNode - The existing value or node in the doubly linked list
* after which the new value will be inserted. It can be either the value of the existing node or the existing node
* itself.
* @param {T} newValue - The value that you want to insert into the doubly linked list.
* @returns The method returns a boolean value. It returns true if the insertion is successful, and false if the
* existing value or node is not found in the doubly linked list.
*/
DoublyLinkedList.prototype.insertAfter = function (existingValue, newValue) {
var existingNode = this.findNode(existingValue);
DoublyLinkedList.prototype.insertAfter = function (existingValueOrNode, newValue) {
var existingNode;
if (existingValueOrNode instanceof (DoublyLinkedListNode)) {
existingNode = existingValueOrNode;
}
else {
existingNode = this.findNode(existingValueOrNode);
}
if (existingNode) {

@@ -554,11 +565,19 @@ var newNode = new DoublyLinkedListNode(newValue);

/**
* The `insertBefore` function inserts a new value before an existing value in a doubly linked list.
* @param {T} existingValue - The existing value is the value of the node that you want to insert the new value before.
* @param {T} newValue - The `newValue` parameter represents the value of the new node that you want to insert before
* the existing node.
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
* existing value is not found in the linked list.
* The `insertBefore` function inserts a new value before an existing value or node in a doubly linked list.
* @param {T | DoublyLinkedListNode<T>} existingValueOrNode - The existing value or node in the doubly linked list
* before which the new value will be inserted. It can be either the value of the existing node or the existing node
* itself.
* @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the doubly linked
* list.
* @returns The method returns a boolean value. It returns `true` if the insertion is successful, and `false` if the
* insertion fails.
*/
DoublyLinkedList.prototype.insertBefore = function (existingValue, newValue) {
var existingNode = this.findNode(existingValue);
DoublyLinkedList.prototype.insertBefore = function (existingValueOrNode, newValue) {
var existingNode;
if (existingValueOrNode instanceof (DoublyLinkedListNode)) {
existingNode = existingValueOrNode;
}
else {
existingNode = this.findNode(existingValueOrNode);
}
if (existingNode) {

@@ -565,0 +584,0 @@ var newNode = new DoublyLinkedListNode(newValue);

export * from './singly-linked-list';
export * from './doubly-linked-list';
export * from './skip-linked-list';

@@ -19,1 +19,2 @@ "use strict";

__exportStar(require("./doubly-linked-list"), exports);
__exportStar(require("./skip-linked-list"), exports);

@@ -92,13 +92,6 @@ /**

deleteAt(index: number): T | null;
delete(valueOrNode: T): boolean;
delete(valueOrNode: SinglyLinkedListNode<T>): boolean;
/**
* The `delete` function removes a specified value from a linked list and returns true if the value was found and
* removed, otherwise it returns false.
* @param {T} value - The value parameter represents the value of the node that needs to be deleted from the linked
* list.
* @returns The `delete` method returns a boolean value. It returns `true` if the value was successfully deleted from
* the linked list, and `false` if the value was not found in the linked list.
*/
delete(value: T): boolean;
/**
* The `insert` function inserts a value at a specified index in a singly linked list.
* The `insertAt` 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

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

*/
insert(index: number, val: T): boolean;
insertAt(index: number, val: T): boolean;
/**

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

findNode(value: T): SinglyLinkedListNode<T> | null;
/**
* The `insertBefore` function inserts a new value before an existing value in a singly linked list.
* @param {T} existingValue - The existing value is the value that already exists in the linked list and before which
* we want to insert a new value.
* @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
* @returns The `insertBefore` function returns a boolean value. It returns `true` if the `newValue` is successfully
* inserted before the first occurrence of `existingValue` in the linked list. It returns `false` if the
* `existingValue` is not found in the linked list.
*/
insertBefore(existingValue: T, newValue: T): boolean;
insertBefore(existingValue: SinglyLinkedListNode<T>, newValue: T): boolean;
insertAfter(existingValueOrNode: T, newValue: T): boolean;
insertAfter(existingValueOrNode: SinglyLinkedListNode<T>, newValue: T): boolean;
/**
* The function inserts a new value after an existing value in a singly linked list.
* @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
* @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list
* after the node with the `existingValue`.
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
* existing value is not found in the linked list.
*/
insertAfter(existingValue: T, newValue: T): boolean;
/**
* The function counts the number of occurrences of a given value in a linked list.

@@ -178,0 +156,0 @@ * @param {T} value - The value parameter is the value that you want to count the occurrences of in the linked list.

@@ -260,12 +260,17 @@ "use strict";

/**
* The `delete` function removes a specified value from a linked list and returns true if the value was found and
* removed, otherwise it returns false.
* @param {T} value - The value parameter represents the value of the node that needs to be deleted from the linked
* list.
* @returns The `delete` method returns a boolean value. It returns `true` if the value was successfully deleted from
* the linked list, and `false` if the value was not found in the linked list.
* The delete function removes a node with a specific value from a singly linked list.
* @param {T | SinglyLinkedListNode<T>} valueOrNode - The `valueOrNode` parameter can accept either a value of type `T`
* or a `SinglyLinkedListNode<T>` object.
* @returns The `delete` method returns a boolean value. It returns `true` if the value or node is found and
* successfully deleted from the linked list, and `false` if the value or node is not found in the linked list.
*/
SinglyLinkedList.prototype.delete = function (value) {
var current = this.head;
var prev = null;
SinglyLinkedList.prototype.delete = function (valueOrNode) {
var value;
if (valueOrNode instanceof (SinglyLinkedListNode)) {
value = valueOrNode.val;
}
else {
value = valueOrNode;
}
var current = this.head, prev = null;
while (current) {

@@ -294,3 +299,3 @@ if (current.val === value) {

/**
* The `insert` function inserts a value at a specified index in a singly linked list.
* The `insertAt` 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

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

*/
SinglyLinkedList.prototype.insert = function (index, val) {
SinglyLinkedList.prototype.insertAt = function (index, val) {
if (index < 0 || index > this.length)

@@ -424,13 +429,18 @@ return false;

* The `insertBefore` function inserts a new value before an existing value in a singly linked list.
* @param {T} existingValue - The existing value is the value that already exists in the linked list and before which
* we want to insert a new value.
* @param {T | SinglyLinkedListNode<T>} 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 {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list.
* @returns The `insertBefore` function returns a boolean value. It returns `true` if the `newValue` is successfully
* inserted before the first occurrence of `existingValue` in the linked list. It returns `false` if the
* `existingValue` is not found in the linked list.
* @returns The method `insertBefore` returns a boolean value. It returns `true` if the new value was successfully
* inserted before the existing value, and `false` otherwise.
*/
SinglyLinkedList.prototype.insertBefore = function (existingValue, newValue) {
if (!this.head) {
SinglyLinkedList.prototype.insertBefore = function (existingValueOrNode, newValue) {
if (!this.head)
return false;
var existingValue;
if (existingValueOrNode instanceof (SinglyLinkedListNode)) {
existingValue = existingValueOrNode.val;
}
else {
existingValue = existingValueOrNode;
}
if (this.head.val === existingValue) {

@@ -454,11 +464,17 @@ this.unshift(newValue);

/**
* The function inserts a new value after an existing value in a singly linked list.
* @param {T} existingValue - The existing value is the value of the node after which we want to insert the new value.
* @param {T} newValue - The `newValue` parameter represents the value that you want to insert into the linked list
* after the node with the `existingValue`.
* @returns The method is returning a boolean value. It returns true if the insertion is successful and false if the
* existing value is not found in the linked list.
* The `insertAfter` function inserts a new node with a given value after an existing node in a singly linked list.
* @param {T | SinglyLinkedListNode<T>} existingValueOrNode - The existing value or node in the linked list after which
* the new value will be inserted. It can be either the value of the existing node or the existing node itself.
* @param {T} newValue - The value that you want to insert into the linked list after the existing value or node.
* @returns The method returns a boolean value. It returns true if the new value was successfully inserted after the
* existing value or node, and false if the existing value or node was not found in the linked list.
*/
SinglyLinkedList.prototype.insertAfter = function (existingValue, newValue) {
var existingNode = this.findNode(existingValue);
SinglyLinkedList.prototype.insertAfter = function (existingValueOrNode, newValue) {
var existingNode;
if (existingValueOrNode instanceof SinglyLinkedListNode) {
existingNode = existingValueOrNode;
}
else {
existingNode = this.findNode(existingValueOrNode);
}
if (existingNode) {

@@ -465,0 +481,0 @@ var newNode = new SinglyLinkedListNode(newValue);

@@ -1,1 +0,2 @@

export {};
export declare class SkipLinkedList {
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SkipLinkedList = void 0;
var SkipLinkedList = /** @class */ (function () {
function SkipLinkedList() {
}
return SkipLinkedList;
}());
exports.SkipLinkedList = SkipLinkedList;

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

// */
// public static transform(vector: Vector2D, transformation: Matrix2D): Vector2D {
// static transform(vector: Vector2D, transformation: Matrix2D): Vector2D {
// return Matrix2D.multiplyByVector(transformation, vector)

@@ -232,3 +232,3 @@ // }

// */
// public static transformList(vectors: Vector2D[], transformation: Matrix2D): Vector2D[] {
// static transformList(vectors: Vector2D[], transformation: Matrix2D): Vector2D[] {
// return vectors.map(vector => Matrix2D.multiplyByVector(transformation, vector))

@@ -235,0 +235,0 @@ // }

{
"name": "data-structure-typed",
"version": "1.17.0",
"version": "1.17.3",
"description": "Explore our comprehensive Javascript Data Structure / TypeScript Data Structure Library, meticulously crafted to empower developers with a versatile set of essential data structures. Our library includes a wide range of data structures, such as Binary Tree, AVL Tree, Binary Search Tree (BST), Tree Multiset, Segment Tree, Binary Indexed Tree, Graph, Directed Graph, Undirected Graph, Singly Linked List, Hash, CoordinateSet, CoordinateMap, Heap, Doubly Linked List, Priority Queue, Max Priority Queue, Min Priority Queue, Queue, ObjectDeque, ArrayDeque, Stack, and Trie. Each data structure is thoughtfully designed and implemented using TypeScript to provide efficient, reliable, and easy-to-use solutions for your programming needs. Whether you're optimizing algorithms, managing data, or enhancing performance, our TypeScript Data Structure Library is your go-to resource. Elevate your coding experience with these fundamental building blocks for software development.",

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

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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