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
Insert a value to create the first node and initialize the memory chain.
System is waiting for the next operation.
Queue up operations in step mode and execute them one by one.
Complexity
O(1) for insert/delete, O(n) for searchO(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.nextRelated Algorithms
Stack
A Stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. Elements are added and removed from the same end (top). Common operations include push, pop, and peek.
Queue
A Queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. Elements are added at the rear and removed from the front. Common operations include enqueue and dequeue.