max-priority-queue-typed
Advanced tools
Comparing version 1.38.4 to 1.38.5
@@ -126,3 +126,3 @@ /** | ||
*/ | ||
findNode(val: E): DoublyLinkedListNode<E> | null; | ||
findNode(val: E | null): DoublyLinkedListNode<E> | null; | ||
/** | ||
@@ -233,4 +233,13 @@ * The `insert` function inserts a value at a specified index in a doubly linked list. | ||
insertAfter(existingValueOrNode: DoublyLinkedListNode<E>, newValue: E): boolean; | ||
insertBefore(existingValueOrNode: E, newValue: E): boolean; | ||
insertBefore(existingValueOrNode: DoublyLinkedListNode<E>, newValue: E): boolean; | ||
/** | ||
* The `insertBefore` 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 | ||
* before which the new value will be inserted. It can be either the value of the existing node or the existing node | ||
* itself. | ||
* @param {E} 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. | ||
*/ | ||
insertBefore(existingValueOrNode: E | DoublyLinkedListNode<E>, newValue: E): boolean; | ||
} |
@@ -91,5 +91,11 @@ /** | ||
deleteAt(index: number): E | undefined; | ||
delete(valueOrNode: E): boolean; | ||
delete(valueOrNode: SinglyLinkedListNode<E>): boolean; | ||
/** | ||
* The delete function removes a node with a specific value from a singly linked list. | ||
* @param {E | SinglyLinkedListNode<E>} valueOrNode - The `valueOrNode` parameter can accept either a value of type `E` | ||
* or a `SinglyLinkedListNode<E>` 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. | ||
*/ | ||
delete(valueOrNode: E | SinglyLinkedListNode<E> | null | undefined): boolean; | ||
/** | ||
* The `insertAt` function inserts a value at a specified index in a singly linked list. | ||
@@ -147,4 +153,11 @@ * @param {number} index - The index parameter represents the position at which the new value should be inserted in the | ||
findNode(value: E): SinglyLinkedListNode<E> | null; | ||
insertBefore(existingValue: E, newValue: E): boolean; | ||
insertBefore(existingValue: SinglyLinkedListNode<E>, newValue: E): boolean; | ||
/** | ||
* The `insertBefore` 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 | ||
* inserted before the existing value, and `false` otherwise. | ||
*/ | ||
insertBefore(existingValueOrNode: E | SinglyLinkedListNode<E>, newValue: E): boolean; | ||
insertAfter(existingValueOrNode: E, newValue: E): boolean; | ||
@@ -151,0 +164,0 @@ insertAfter(existingValueOrNode: SinglyLinkedListNode<E>, newValue: E): boolean; |
@@ -205,2 +205,4 @@ "use strict"; | ||
delete(valueOrNode) { | ||
if (!valueOrNode) | ||
return false; | ||
let value; | ||
@@ -207,0 +209,0 @@ if (valueOrNode instanceof SinglyLinkedListNode) { |
{ | ||
"name": "max-priority-queue-typed", | ||
"version": "1.38.4", | ||
"version": "1.38.5", | ||
"description": "Max Priority Queue. Javascript & Typescript Data Structure.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -269,3 +269,3 @@ /** | ||
*/ | ||
findNode(val: E): DoublyLinkedListNode<E> | null { | ||
findNode(val: E | null): DoublyLinkedListNode<E> | null { | ||
let current = this.head; | ||
@@ -345,3 +345,3 @@ | ||
*/ | ||
delete(valOrNode: E | DoublyLinkedListNode<E>): boolean { | ||
delete(valOrNode: E | DoublyLinkedListNode<E> | null): boolean { | ||
let node: DoublyLinkedListNode<E> | null; | ||
@@ -599,4 +599,2 @@ | ||
insertBefore(existingValueOrNode: E, newValue: E): boolean; | ||
insertBefore(existingValueOrNode: DoublyLinkedListNode<E>, newValue: E): boolean; | ||
@@ -603,0 +601,0 @@ /** |
@@ -217,5 +217,2 @@ /** | ||
delete(valueOrNode: E): boolean; | ||
delete(valueOrNode: SinglyLinkedListNode<E>): boolean; | ||
/** | ||
@@ -228,3 +225,4 @@ * The delete function removes a node with a specific value from a singly linked list. | ||
*/ | ||
delete(valueOrNode: E | SinglyLinkedListNode<E>): boolean { | ||
delete(valueOrNode: E | SinglyLinkedListNode<E> | null | undefined): boolean { | ||
if (!valueOrNode) return false; | ||
let value: E; | ||
@@ -402,5 +400,2 @@ if (valueOrNode instanceof SinglyLinkedListNode) { | ||
insertBefore(existingValue: E, newValue: E): boolean; | ||
insertBefore(existingValue: SinglyLinkedListNode<E>, newValue: E): boolean; | ||
/** | ||
@@ -407,0 +402,0 @@ * The `insertBefore` function inserts a new value before an existing value in a singly linked list. |
1263973
24696