Linked List

A Linked List is a linear data structure where elements are stored in nodes, and each node points to the next node. It allows dynamic memory allocation and efficient insertion/deletion operations.

Linked List Visualization

1.0x
State: IDLE
Nodes: 0/12
Audio: WAITING INTERACTION
Data Stream
A Linked List stores elements as nodes, where each node points to the next one.
Current structure
Empty
Linked List Core
Memory Chain
Linked List is Empty

Insert a value to create the first node and initialize the memory chain.

Head:NULL
Length:0
Execution Panel
Algorithm Trace
JS Runtime
linked-list.ts
1
class Node { value; next; }
2
insert(value) {
3
const newNode = new Node(value);
4
newNode.next = head;
5
head = newNode;
6
}
7
remove() {
8
if (head) head = head.next;
9
}
Current Operation
IDLE

System is waiting for the next operation.

Pending Step
NONE

Queue up operations in step mode and execute them one by one.

Complexity

Time Complexity: O(1) for insert/delete, O(n) for search
Space Complexity: O(n)

Pseudocode

class Node:
  data: value
  next: pointer to next node
  
class LinkedList:
  function insert(value, position):
    new_node = Node(value)
    new_node.next = current_node.next
    current_node.next = new_node
  
  function delete(value):
    find node with value
    previous.next = current.next