LinkedList with superpowers! 馃挭
$ yarn add @clarketm/superlinkedlist
$ npm install @clarketm/superlinkedlist --save
Construct a LinkedList
Get the size of the list
Get the head of the list
Get the tail of the list
Insert a node at a given position
Name | Type | Attribute | Description |
---|---|---|---|
position | number | position to insert node | |
value | Item | value to insert into list |
Alias to
insert(0, value)
Prepend a node to the front of the list
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to prepend to list |
Alias to
insert(0, value)
Unshift a node to the front of the list
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to unshift to list |
Alias to
insert(list.size, value)
Append a node to the rear of the list
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to append to list |
Alias to
insert(list.size, value)
Push a node to the rear of the list
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to push to list |
Remove a node at a given position
Name | Type | Attribute | Description |
---|---|---|---|
position | number | position to remove node |
Alias to
remove(0)
Shift a node from the front of list
Alias to
remove(list.size - 1)
Pop a node from the rear of list
Convert the node and next nodes (recursively) to an array
Construct a ListNode
Get the value of the node
Get the next node in list
Get the previous node in list