DSA-VerseLearn by watching code run
DashboardData StructuresAlgorithmsVisualizerCORECoding PlaygroundInterview QuestionsComplexity AnalyzerLearning NotesBookmarksLearning ProgressSettings

Algorithm Visualizer

Pick an algorithm. Each one runs an instrumented implementation that records every important event, so the animation, the highlighted code line (JavaScript, Python, Java or Go) and the variable inspector always stay in sync.

Sorting

Array

Bubble Sort

Repeatedly compares adjacent elements and swaps them when they are out of order, so the largest unsorted value bubbles to the end after every pass.

O(n²) time · O(1) spaceOpen
Array

Selection Sort

Divides the array into a sorted prefix and an unsorted suffix. Each pass selects the minimum of the unsorted part and swaps it into the next position of the prefix.

O(n²) time · O(1) spaceOpen
Array

Insertion Sort

Builds a sorted prefix one element at a time: the next element (the key) is lifted out, larger elements of the prefix shift one step right, and the key drops into the gap.

O(n²) time · O(1) spaceOpen

Searching

Array

Linear Search

Checks every element from left to right until the target is found or the array ends. Works on unsorted data.

O(n) time · O(1) spaceOpen
Array

Binary Search

Searches a sorted array by repeatedly comparing the target with the middle element and discarding the half that cannot contain it.

O(log n) time · O(1) spaceOpen

Arrays & Hashing

Array

Reverse an Array

Reverses an array in place with two pointers: swap the outermost pair, move both pointers inward, and stop when they meet.

O(n) time · O(1) spaceOpen
Array

Two Sum

Finds two indexes whose values add up to a target in one pass, storing each value's index in a hash map and looking up the complement (target − value).

O(n) time · O(n) spaceOpen

Linked Lists, Stacks & Queues

Linked list

Singly Linked List Insertion

Inserts a new node at a given position: walk to the node just before the position, point the new node at its successor, then re-link the predecessor to the new node.

O(n) time · O(1) spaceOpen
Stack

Stack Push and Pop

A stack is Last-In-First-Out (LIFO): push adds to the top, pop removes from the top. A fixed capacity shows overflow (push when full) and underflow (pop when empty).

O(1) time · O(1) spaceOpen
Queue

Queue Enqueue and Dequeue

A queue is First-In-First-Out (FIFO): enqueue adds at the rear, dequeue removes from the front. This circular-array queue wraps the rear pointer around to reuse freed slots.

O(1) time · O(1) spaceOpen

Trees & Graphs

Tree

Binary Tree Inorder Traversal

Recursively visits the left subtree, then the node itself, then the right subtree (Left → Root → Right). On a Binary Search Tree this produces the values in sorted order.

O(n) time · O(h) spaceOpen
Graph

Graph BFS

Explores the graph level by level using a queue. Because vertices are discovered in order of distance, BFS also finds the shortest path (fewest edges) from the start in an unweighted graph.

O(V + E) time · O(V) spaceOpen
Graph

Graph DFS

Goes as deep as possible along each branch before backtracking. This recursive version uses the call stack as its implicit stack.

O(V + E) time · O(V) spaceOpen