Visualize

DSA Lab

Pick a data structure or algorithm, put in your own values, and watch it change one step at a time, each step explained in plain English.

About the DSA Lab, starting with: Linked list

The DSA Lab has 21 tools: pick one above and it opens on its own page. It starts with this one: Linked list.

A linked list stores each value in its own node, and every node holds a pointer to the next one. The nodes can be anywhere in memory; the pointers give the order.

In this tool: insert, delete, search, reverse. Put in your own values and watch it change. Each operation runs one step at a time and says in plain words what happened, with its calculation worked out. The code is shown in Python, C, C++ or Java with the line that just ran marked, and an Understand it panel gives the idea, why it works, the cost of each operation, common mistakes and a short quiz.

Lessons that use it

  • Linked lists (Python)Chain objects together with references, walk the chain, insert in the middle, and reverse it.
  • Singly linked lists (Data Structures)Append with a tail pointer, search, and delete a value while keeping the chain joined.
  • Doubly and circular linked lists (Data Structures)Nodes with prev and next pointers, removing a node in O(1), and a circle of nodes for the Josephus problem.
  • Linked list patterns (Interview Prep)Reversing a list in place, fast and slow pointers for the middle and for cycles (Floyd's algorithm), merging two sorted lists, and the dummy-head trick.