DSA Bloom logo
DSA BLOOM / ALGORITHMS

Think Smarter.
Code Faster.

Algorithms are the step-by-step strategies that turn problems into working solutions. Learn how to analyze complexity, recognize patterns, choose the right technique, and build efficient solutions from the ground up.

SearchingSortingRecursionGreedyDynamic ProgrammingGraphs
Explore Algorithm Lessons

Algorithm Lessons

Follow the lessons from fundamentals to advanced problem-solving patterns. Each lesson includes its visual guide and a concise explanation.

LESSON

What is an Algorithm?

An algorithm is a clear sequence of steps used to solve a problem or complete a task. Good algorithms are correct, efficient, understandable, and practical to implement.

LESSON

Why Algorithms Matter

Algorithms are the problem-solving engine behind software. Choosing the right approach can make programs faster, more scalable, and easier to maintain.

LESSON

Types of Algorithms

Explore common approaches including brute force, divide and conquer, greedy methods, dynamic programming, backtracking, recursion, and graph algorithms.

LESSON

Algorithm Efficiency

Algorithm efficiency measures how much time and memory an approach needs as the input grows. Understanding efficiency helps you choose solutions that scale.

LESSON

Time Complexity & Big O

Big O notation describes how an algorithm's running time or space requirement grows with input size. Learn to recognize common complexities such as O(1), O(log n), O(n), and O(n²).

LESSON

Common Time Complexities

Compare common complexity classes and learn why logarithmic and linear solutions are often preferred over quadratic approaches for large inputs.

LESSON

Searching Algorithms

Searching algorithms locate a target value inside a collection. The right method depends on how the data is organized and whether it is sorted.

LESSON

Linear Search

Linear search checks elements one by one until it finds the target or reaches the end. It is simple and works even when data is unsorted.

LESSON

Binary Search

Binary search repeatedly divides a sorted search space in half, giving it O(log n) time and making it dramatically faster than linear search for large sorted collections.

LESSON

Sorting Algorithms

Sorting arranges data into a useful order and supports faster searching, merging, reporting, and analysis.

LESSON

Bubble Sort

Bubble sort repeatedly compares neighboring elements and swaps them when they are out of order. It is easy to understand but usually inefficient for large inputs.

LESSON

Selection Sort

Selection sort repeatedly selects the smallest remaining element and places it in its correct position. It uses O(n²) comparisons and is useful for learning sorting fundamentals.

LESSON

Insertion Sort

Insertion sort builds a sorted portion one element at a time. It performs well on small or nearly sorted collections.

LESSON

Merge Sort

Merge sort divides a collection into smaller pieces, sorts them, and merges the results. Its predictable O(n log n) time makes it an important divide-and-conquer algorithm.

LESSON

Quick Sort

Quick sort partitions data around a pivot and recursively sorts the resulting sections. Its average performance is O(n log n).

LESSON

Recursion Basics

Recursion solves a problem by reducing it to smaller versions of the same problem. Every recursive solution needs a clear base case.

LESSON

Recursion Deep Dive

Learn how recursive calls use the call stack, how to trace recursive execution, and how to recognize opportunities for recursive problem solving.

LESSON

Fibonacci with Recursion

The Fibonacci sequence is a classic recursion example. It also demonstrates why repeated work can make a naive recursive solution inefficient.

LESSON

Two-Pointer Technique

The two-pointer technique uses two indexes moving through a collection to reduce unnecessary work and solve many array and string problems efficiently.

LESSON

Sliding Window Technique

Sliding window maintains a changing range over an array or string, often turning repeated O(n²) work into an O(n) solution.

LESSON

Prefix Sum

Prefix sums preprocess cumulative values so range-sum queries can be answered quickly without repeatedly scanning the same elements.

LESSON

Greedy Algorithms

Greedy algorithms make the best-looking local choice at each step. When the problem has the right structure, these choices can produce an optimal solution.

LESSON

Fractional Knapsack

Fractional knapsack demonstrates a greedy strategy: choose items by value-to-weight ratio and take as much of the best available option as possible.

LESSON

Dynamic Programming

Dynamic programming solves problems with overlapping subproblems by storing results and reusing them. It can turn repeated exponential work into efficient polynomial-time solutions.

LESSON

Backtracking — N-Queens

Backtracking builds a solution step by step and abandons a partial choice as soon as it cannot lead to a valid answer. N-Queens is a classic example.

LESSON

Graph Traversal: BFS & DFS

Breadth-first search explores level by level, while depth-first search follows a path as deeply as possible before backtracking. Both are fundamental graph traversal strategies.

LESSON

Breadth-First Search

BFS uses a queue to explore neighbors in layers and is especially useful for shortest paths in unweighted graphs.

LESSON

Depth-First Search

DFS uses a stack or recursion to explore deeply before returning. It is useful for connectivity, cycle detection, topological-style exploration, and many graph problems.

LESSON

Dijkstra's Algorithm

Dijkstra's algorithm finds shortest paths from a source in a graph with non-negative edge weights by repeatedly selecting the closest unresolved vertex.

LESSON

Bit Manipulation Basics

Bit operations work directly with binary representations and can provide compact, fast techniques for masks, parity checks, powers of two, and state representation.

LESSON

String Algorithms Basics

String algorithms solve problems involving searching, matching, counting, comparing, and transforming text efficiently.

LESSON

Practice Problems

Apply each technique to progressively harder problems. Focus on explaining your approach, checking edge cases, and analyzing time and space complexity.

LESSON

Real Problem-Solving Strategy

A strong problem-solving workflow is: understand the requirements, identify patterns, choose a data structure, design the algorithm, test edge cases, and analyze complexity.

LESSON

Interview Preparation

Prepare for technical interviews by practicing patterns, explaining trade-offs, writing clean solutions, and communicating your reasoning clearly.

LESSON

Algorithm Interview Practice

Review common algorithm patterns and practice solving problems under realistic interview conditions.