Linked List
Create a singly Linked List.
Usage
src/sample/linkedlist.ts
import { LinkedList } from 'athro';
let list = new LinkedList();
Available Methods
Methods available for the Linked List.
Methods | Description | Syntax |
---|---|---|
push | Add item to the end of the LL | list.push(value) |
pop | Remove item from the end of the LL | list.pop() |
unshift | Add an item to the front of the LL | list.unshift(value) |
shift | Remove an item from the front of the LL | list.shift() |
get | Get a node from the LL | list.get(index) |
set | Set value for an existing node in the LL | list.set(index, value) |
insert | Insert a value at a specific index in the LL | list.insert(index, value) |
remove | Remove an item from specific position of the LL | list.remove(index) |
reverse | Reverse the LL | list.reverse() |
traverse | Traverse and print the LL | list.traverse() |