Linked List
Nodes connected by pointers — traversal and insertion made visible.
A linked list stores each element in its own node, connected to the next by a pointer. Unlike an array it has no contiguous block, so insertion and deletion are O(1) once you hold the node — but random access is O(n).
Pointers are where beginners struggle: what does `head->next` point to, and what happens to the chain when you insert or delete? Following the arrows in memory removes the mystery.
AlgoLens draws each node and the pointer arrows between them, straight from the heap — so `next` is a real arrow you can follow, not an address to imagine.
The code
#include <bits/stdc++.h>
using namespace std;
struct Node {
int val;
Node* next;
};
int main() {
Node* head = nullptr;
for (int i = 5; i >= 1; i--) {
head = new Node{i, head};
}
int sum = 0;
for (Node* cur = head; cur != nullptr; cur = cur->next) {
sum += cur->val;
}
cout << sum << '\n';
return 0;
}
Now run your own Linked List
AlgoLens traces your code — arrays, graphs, trees and recursion — from a real execution, so you see how it actually behaves, not a canned animation.
Paste your codeKeep going
Union-Find (DSU)
Merge disjoint sets and query connectivity almost in constant time.
Stack and Queue
Last-in-first-out versus first-in-first-out, side by side.
Priority Queue (Binary Heap)
Always pop the largest — a tree hiding inside an array.
Prefix Sums
Precompute once, then answer any range sum with a single subtraction.