Hello, Algorithm!
An introduction to what algorithms are and why they matter in our world.
Why Learn Algorithms?
A few years ago, when I started publishing solutions to coding problems on LeetCode, I was fortunate to receive encouragement from many readers. The question I was asked most often was: “How do I get started with algorithms?”
Blindly grinding problems is the most common approach—simple, direct, and sometimes effective. However, it's like playing Minesweeper: those with strong self-learning abilities can clear mines one by one, while others may get overwhelmed and retreat with each misstep.
Reading textbooks continuously is another approach, but for those focused on interviews or practical applications, tackling a thick academic book can feel like a daunting task.
💡 This guide aims to help you build a “knowledge map” of algorithms and data structures—showing you the shapes, sizes, and relationships between different concepts, so you can navigate with confidence.
What is an Algorithm?
The computer has brought tremendous change to our world—it operates at high speed and is programmable, making it an ideal medium for executing algorithms.
Whether it's generating realistic visuals in video games, making intelligent decisions in autonomous vehicles, playing a brilliant game of Go, or having natural conversations with ChatGPT—these are all wonderful performances of algorithms on computers.
🎯 Algorithm Definition
An algorithm is a well-defined sequence of steps or instructions designed to solve a specific problem or perform a computation.
In fact, even before computers existed, algorithms and data structures were found everywhere. Early algorithms were simple: ways of counting, steps of craftsmanship. As civilization advanced, algorithms became more precise and complex—from master craftsmanship to industrial manufacturing, to scientific laws governing the universe.
Data Structures Are Everywhere
Data structures are omnipresent in our daily lives. Here are some real-world analogies:
Graphs
Social networks, metro lines, road maps—all can be modeled as graphs.
Trees
Company hierarchies, family trees, file systems—all follow tree structures.
Stacks
Like layered winter clothes: what you put on first comes off last (LIFO).
Queues
Like waiting in line: first come, first served (FIFO).
Hash Tables
Like a dictionary: look up any word instantly by its key.
Arrays
Like numbered lockers: access any item directly by its index.
Why Algorithms Matter
Performance
The right algorithm can make your code run 1000x faster. O(n²) vs O(n log n) matters!
Interviews
Top tech companies test algorithm skills. Understanding fundamentals gives you an edge.
Problem Solving
Algorithmic thinking helps you break down complex problems into manageable steps.
Better Code
Understanding data structures helps you choose the right tool for each job.
“Knowledge isn't free. You have to pay attention.”
— Richard Feynman
From this perspective, learning algorithms requires focus and dedication. But the investment pays off—with a solid understanding of algorithms and data structures, you'll be more confident solving problems, reading papers, and building efficient systems.
What's Next?
In the following sections, we'll explore:
- Complexity Analysis — How to measure algorithm efficiency (Big O notation)
- Data Structures — Arrays, Linked Lists, Trees, Graphs, Hash Tables
- Sorting & Searching — Fundamental algorithms every developer should know
- Dynamic Programming — Breaking complex problems into simpler subproblems
- Graph Algorithms — BFS, DFS, Shortest Path, and more
Content adapted and translated from Hello 算法 (Hello Algorithm) by Krahets, licensed under CC BY-NC-SA 4.0.