Browse Topics

25 topics. Click "Study" to add to your review queue.

Backtracking

Systematically explore all possible solutions by building candidates and abandoning them when they fail constraints

Other

BFS (Breadth-First Search)

Explore a tree level by level using a queue

Trees

Binary Search

Efficiently find a target in a sorted collection by repeatedly halving the search space

Searching

Binary Search Tree

A binary tree where left children are smaller and right children are larger, enabling fast lookup

Trees

Counting Sort

Sort integers by counting occurrences of each value — no comparisons needed

Sorting

Cycle Detection

Detect if a linked list contains a cycle using Floyd's tortoise and hare algorithm

Linked Lists

DFS (Depth-First Search)

Explore a tree by going as deep as possible before backtracking

Trees

Dijkstra's Algorithm

Find the shortest path from a source to all other nodes in a weighted graph with non-negative edges

Graphs

Fibonacci DP

Compute Fibonacci numbers efficiently using memoization or tabulation to avoid redundant work

Dynamic Programming

Graph BFS

Explore a graph layer by layer to find shortest paths in unweighted graphs

Graphs

Graph DFS

Explore a graph by going as deep as possible along each branch before backtracking

Graphs

Heap Sort

Build a max-heap from the array, then repeatedly extract the maximum to sort

Sorting

Kadane's Algorithm

Find the maximum sum contiguous subarray in a single pass

Arrays

Knapsack

Maximize value by selecting items with weight constraints using dynamic programming

Dynamic Programming

Linked List Reversal

Reverse the direction of pointers in a linked list

Linked Lists

Merge Sort

Divide the array in half, sort each half, then merge the sorted halves

Sorting

Merge Two Sorted Lists

Combine two sorted linked lists into one sorted list by rewiring pointers

Linked Lists

Monotonic Stack

Maintain a stack where elements are always in increasing or decreasing order to find next greater/smaller elements efficiently

Other

Prefix Sum

Precompute cumulative sums to answer range-sum queries in constant time

Arrays

Quick Sort

Pick a pivot, partition elements around it, and recursively sort each side

Sorting

Sliding Window

Maintain a window over a contiguous subarray and slide it across to track running computations

Arrays

Topological Sort

Order vertices of a DAG so every edge goes from earlier to later in the ordering

Graphs

Trie

A prefix tree that stores strings character by character for fast prefix lookups

Trees

Two Pointers

Use two indices moving through an array to solve problems in a single pass

Arrays

Union-Find

Track disjoint sets with near-constant-time union and find operations

Graphs