repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build: bump volta pnpm version
[poolifier.git]
/
src
/
deque.ts
diff --git
a/src/deque.ts
b/src/deque.ts
index 257643726383945d81960ec2cd7be0c04d26eecb..52441a3ec25f4f7251575104a0884f9ffeb22d00 100644
(file)
--- a/
src/deque.ts
+++ b/
src/deque.ts
@@
-35,13
+35,14
@@
export class Deque<T> {
* Appends data to the deque.
*
* @param data - Data to append.
* Appends data to the deque.
*
* @param data - Data to append.
- * @returns The new size of the
que
ue.
+ * @returns The new size of the
deq
ue.
*/
public push (data: T): number {
*/
public push (data: T): number {
- const node
= { data, prev: this.tail
}
+ const node
: ILinkedListNode<T> = { data
}
if (this.tail == null) {
this.head = this.tail = node
} else {
if (this.tail == null) {
this.head = this.tail = node
} else {
+ node.prev = this.tail
this.tail = this.tail.next = node
}
return this.incrementSize()
this.tail = this.tail.next = node
}
return this.incrementSize()
@@
-51,13
+52,14
@@
export class Deque<T> {
* Prepends data to the deque.
*
* @param data - Data to prepend.
* Prepends data to the deque.
*
* @param data - Data to prepend.
- * @returns The new size of the
que
ue.
+ * @returns The new size of the
deq
ue.
*/
public unshift (data: T): number {
*/
public unshift (data: T): number {
- const node
= { data, next: this.head
}
+ const node
: ILinkedListNode<T> = { data
}
if (this.head == null) {
this.head = this.tail = node
} else {
if (this.head == null) {
this.head = this.tail = node
} else {
+ node.next = this.head
this.head = this.head.prev = node
}
return this.incrementSize()
this.head = this.head.prev = node
}
return this.incrementSize()