StudyDSA logoStudyDSA
Data StructuresAlgorithmsBig-O NotationPractice

Command Palette

Search for a command to run...

Sign InSign Up

Data StructuresAlgorithmsBig-O Notation

Two PointersFast & Slow PointersSliding WindowBinary SearchPrefix SumsRecursionSortingBacktracking1D Dynamic ProgrammingGreedyIntervalsBit OperationsDepth-First SearchBreadth-First Search2D Dynamic ProgrammingTwo-Heaps PatternDijkstra's AlgorithmA* Search AlgorithmFloyd-Warshall's AlgorithmBellman-Ford AlgorithmPrim's AlgorithmKruskal's AlgorithmTopological SortDAG Shortest Path

Definition
StudyDSA

Where complexity meets clarity.
By Armas Zarra.

Topics

  • Data Structures
  • Algorithms
  • Big-O Notation
  • Robotics
  • AI Research
  • Machine Learning

Practice

  • Blind 75
  • LeetCode 75
  • NeetCode 150

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Armas Films LLC

Built with ♥ by Armas Zarra

IntroductionAlgorithms

Algorithms

A step-by-step procedure for solving a problem or accomplishing a task.

Definition

An algorithm is a step-by-step procedure or formula for solving a problem. In computer science, algorithms are essential for performing calculations, data processing, and automated reasoning tasks.

Learning Path

Follow this path from basic techniques to advanced algorithms. Each topic builds on concepts from the previous, so working through them in order gives you the strongest understanding.

Basics

Two Pointers

→

A technique using two pointers to traverse data structures efficiently.

1
3
5
7
9
11
L →← R

Fast & Slow Pointers

→

A technique using two pointers moving at different speeds to detect cycles.

+1+2ABCDEFslowfast

Sliding Window

→

A technique for processing contiguous subarrays or substrings efficiently.

2
1
5
1
3
2
length = 3

Binary Search

→

An efficient algorithm for finding elements in sorted data by halving the search space.

1
3
5
7
9
11
13
L
mid
R

Prefix Sums

→

A technique for preprocessing arrays to answer range sum queries in constant time.

1
2
3
4
5
↓↓↓↓↓
1
3
6
10
15

Recursion

→

A method where a function calls itself to solve smaller instances of the same problem.

f(4)f(3)f(2)return 1

Tree Traversal

→

Algorithms for visiting all nodes in a tree data structure systematically.

1253467

Sorting

→

Algorithms for arranging elements in a specific order for efficient processing.

Intermediate

Backtracking

→

An algorithmic technique for solving problems by exploring all possibilities.

✕✕

1D Dynamic Programming

→

Dynamic programming applied to one-dimensional subproblem structures.

0
1
1
2
3
5
8
0
1
2
3
4
5
6

Greedy

→

An approach that makes the locally optimal choice at each step.

10¢
50¢
1¢
25¢
5¢
pick largest first

Intervals

→

Techniques for solving problems involving overlapping or merging intervals.

Bit Operations

→

Techniques for manipulating individual bits in binary representations.

A
10110100
B
11010010
&
10010000

Depth-First Search

→

An algorithm for traversing graphs by exploring as far as possible along each branch.

Breadth-First Search

→

An algorithm for traversing graphs level by level from the source.

ABCDEFGL0L1L2
Advanced

2D Dynamic Programming

→

Dynamic programming applied to two-dimensional subproblem structures.

m
a
s
t
e
r
m
i
n
d
m
1
1
1
1
1
1
1
1
1
1
i
1
1
1
1
1
1
1
2
2
2
n
1
1
1
1
1
1
1
2
3
3
d
1
1
1
1
1
1
1
2
3
4

Two-Heaps Pattern

→

A pattern using two heaps to efficiently track medians or extremes.

531max5.5median689min

Dijkstra's Algorithm

→

An algorithm for finding the shortest paths from a source vertex in weighted graphs.

231745SABCD

A* Search Algorithm

→

A pathfinding algorithm that uses heuristics to find optimal paths efficiently.

·
·
·
·
·
S
E

Floyd-Warshall's Algorithm

→

An algorithm for finding shortest paths between all pairs of vertices.

A
B
C
D
A
0
3
∞
7
B
3
0
2
∞
C
∞
2
0
1
D
7
∞
1
0

Bellman-Ford Algorithm

→

An algorithm for finding shortest paths from a source, handling negative weights.

4235-3SD

Prim's Algorithm

→

An algorithm for finding the minimum spanning tree of a weighted graph.

1232

Kruskal's Algorithm

→

An algorithm for finding the minimum spanning tree using edge sorting.

1234

Topological Sort

→

An algorithm for ordering vertices in a directed acyclic graph linearly.

123456

DAG Shortest Path

→

An algorithm for finding shortest paths in directed acyclic graphs efficiently.

213542SD
Importance

Algorithms are important because they optimize the efficiency of programs, enabling tasks to be completed quickly and using fewer resources. They provide a clear, step-by-step method for solving problems, making complex tasks more manageable.


Efficient algorithms ensure reliable and consistent results, can be reused across different projects, and scale well to handle increasing amounts of data or users. As the foundation of all computer programs, algorithms are crucial for creating effective and reliable software.


Algorithms optimize the efficiency of programs, enabling tasks to be completed quickly and using fewer resources. The gap between O(n) and O(n²) is invisible at ten items, but at ten million it's the difference between a fast response and a request that never finishes.

Complexity

Algorithm complexity is a measure of the amount of time and/or space required by an algorithm for an input of a given size (n). It is often expressed using Big-O notation, which describes the upper bound of an algorithm's running time or space requirements in the worst-case scenario.

TimeSpacefastest ↑least memory ↑LookupLookupCacheCacheIn-placeIn-placeStreamStream

These two costs usually trade off against each other. Faster algorithms tend to use more memory, and memory-efficient algorithms tend to take more time.

Problem Solving

Selecting the right algorithm is important for solving a problem efficiently. Choosing the wrong algorithm can significantly impact the performance and scalability of your solution. Here are some key factors to consider when choosing an algorithm:

1. Problem Type

Different algorithms are suited to different types of problems. For example, dynamic programming is ideal for optimization problems, where the solution can be broken down into simpler subproblems and reused. Understanding the nature of the problem helps in selecting an algorithm that can solve it effectively.

2. Data Structure

The choice of data structure can significantly affect the performance of an algorithm. Choosing the right data structure ensures that the algorithm can perform its operations efficiently.

3. Space-Time Tradeoff

Consider both the time and space complexity of an algorithm. For time-critical applications, an algorithm with a lower time complexity is preferred, even if it uses more memory. Similarly, for better memory, an algorithm with a lower space complexity may be more suitable.

4. Scalability

Consider how the algorithm performs as the size of the input data grows. An algorithm that works well for small datasets might become impractical for larger ones. Make sure that the chosen algorithm can scale efficiently with the input size, especially for applications expected to handle large volumes of data.