A singly linked list stores each value in its own node, and each node holds the address of the next node. This visualizer shows that literally: nodes appear at scattered memory addresses, every node shows the address stored in its next field (or NULL), and arrows show where each pointer leads. Switch to List order to see the same nodes lined up in the order the pointers visit them.
Insert at the head, at the tail or at any index, delete a value, search, or reverse the whole list, and watch each operation one pointer change at a time with the matching pseudocode line highlighted. The counters show how many pointer steps each operation needed, so you can see why insert at the head is O(1) but insert at the tail is O(n) without a tail pointer.
How to use the Singly Linked List Visualizer tool
- Type a value (and an index for insert at index).
- Press Insert at head, Insert at tail, Insert at index, Delete value, Search value or Reverse.
- Watch the animation: the orange node is where the walking pointer (cur or prev) is, green is new or found, red is being deleted. The red arrow is the pointer that just changed.
- Use Step and Back to go through it slowly, and switch between Memory and List order views.
Why use ToolOrca Singly Linked List Visualizer
- Memory view with real addresses and next-pointer fields
- List-order view of the same nodes
- Insert at head, tail or index, delete, search and reverse
- Changed pointers highlighted in red
- Pseudocode highlighted line by line
- Code in C++, Java, Python and JavaScript
- Complexity table for every operation
How a singly linked list works
Each node has two fields: the value and a next pointer holding the memory address of the following node. The list itself only remembers the address of the first node, the head. The last node’s next pointer is NULL (None in Python, null in Java and JavaScript), which marks the end.
Because nodes are linked by addresses, they can live anywhere in memory. That is the opposite of an array: there is no formula to find the 5th node, so you must start at the head and follow 4 pointers. On the other hand, adding a node never moves the others. You only change one or two pointers.
Insert, delete and reverse step by step
Insert at head: create the node, set node.next = head, then head = node. Two pointer changes, O(1). Insert after a node: node.next = cur.next, then cur.next = node. The order matters: if you overwrite cur.next first, you lose the rest of the list.
Delete: walk with a prev pointer until prev.next holds the value, then set prev.next = prev.next.next so the list skips the node, and free it. Reverse: walk the list with prev, cur and next pointers and turn every next pointer around. It is a classic interview question and runs in O(n) time with O(1) extra space.
Linked list or array?
A linked list wins when you insert or remove at the front often, when you already hold a pointer to where the change happens, or when elements must not move in memory. An array wins for access by index, for searching sorted data with binary search, and for speed in loops, because array elements sit together in the CPU cache while list nodes are scattered.
Every visualizer on this site runs in your browser with the same controls: Play, Pause, Step forward, Step back and a speed slider. You can also drag the position slider to jump to any step, or focus the drawing and use the Space bar and arrow keys.
Frequently asked questions
What is a singly linked list?
A chain of nodes where each node stores a value and the address of the next node. You can only move forward, from the head towards the NULL at the end.
Why is accessing the nth element O(n)?
There is no address formula as in an array. You must start at the head and follow next pointers one at a time until you reach position n.
How do you reverse a singly linked list?
Keep three pointers: prev = null, cur = head and next. In a loop save next = cur.next, set cur.next = prev, then move prev = cur and cur = next. When cur is null, prev is the new head.
Why is insert at tail O(n) here?
This list keeps only a head pointer, so it must walk to the last node first. Keeping a separate tail pointer makes insert at the tail O(1), as in the doubly linked list visualizer.
Do linked lists use more memory than arrays?
Yes. Every node stores a pointer (8 bytes on a 64-bit system) in addition to the value, and memory allocators add their own overhead for each node.