Tags

Pointers

Pointers

1 lesson
7 problems
1 question bank

pointers

Data Structures

1 lesson

Linked Lists (Singly)

Free
Beginner

45 min

2 prereqs

Inserting at the front of an array of one million items forces every existing element to slide one slot to the right. A **Linked List** sidesteps that copy entirely: a head insertion is two pointer assignments and nothing else, no matter how many nodes follow. In this lesson, each node holds a value and a `next` reference, and you chain those nodes into a singly linked list with explicit head and optional tail pointers. You will implement traversal, head and tail and middle insertion, deletion by value and by position, and linear search, and you will analyze each operation precisely so the trade-off against arrays becomes concrete: `O(1)` insertion at the head, `O(n)` access by index, and per-node memory overhead for the pointer. In **Arrays & Strings**, the `O(n)` cost of inserting near the front came from shifting; the linked list was invented to remove that shift. **Memory Models** introduced the difference between a contiguous block on the stack or heap and scattered allocations connected by references, and that mental model is exactly how a node-based structure lives in memory. Once you are comfortable manipulating `next` pointers, **Stack (LIFO)** uses a linked list (or a dynamic array) as its underlying storage and adds a strict push, pop, peek discipline on top.

Not Started

0%

Singly Linked List
Data Structures
Beginner
Free
Time Complexity
Space Complexity
Memory Models
Fundamentals
Pointers

Practice Problems

7 problems

Reverse Linked List

Free
Not Started
Easy

Given the head of a singly linked list, reverse the list and return the new head.

Singly Linked List
Pointers
Recursion
Beginner

262

4

Reverse Nodes in k-Group

Free
Not Started
Hard

Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list. Nodes left over at the end that are fewer than k should remain in their original order.

Singly Linked List
Pointers
Recursion
Advanced

885

19

Add Two Numbers

Free
Not Started
Medium

Given two non-empty linked lists representing two non-negative integers in reverse order, add the two numbers and return the sum as a linked list.

Singly Linked List
Pointers
Intermediate

541

9

Remove Duplicates from Sorted List II

Free
Not Started
Medium

Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.

Singly Linked List
Pointers
Intermediate

154

4

Reverse Linked List II

Free
Not Started
Medium

Given the head of a singly linked list and two integers left and right, reverse the nodes of the list from position left to position right, and return the reversed list.

Singly Linked List
Pointers
Intermediate

681

20

Rotate List

Free
Not Started
Medium

Given the head of a linked list, rotate the list to the right by k places.

Singly Linked List
Pointers
Intermediate

702

20

Swap Nodes in Pairs

Free
Not Started
Medium

Given a linked list, swap every two adjacent nodes and return its head. You must solve it without modifying the values in the list's nodes.

Singly Linked List
Pointers
Recursion
Intermediate

490

11