The history of computer science is full of brilliant algorithms that solved complex problems elegantly. Some sort data, others find paths, and others protect your credit cards.
Famous algorithms are classic solutions to problems that appear over and over again in computer science.
We already know what an algorithm is and how to measure its efficiency with Big O. Now it’s time to put names to some of those recipes that have ended up appearing in thousands of programs, libraries, and real-world systems.
You don’t need to know how to implement them all from memory right now. The important thing is to know they exist, what problem they solve, and when their name should ring a bell.
Summary
This list is not intended to be complete. It’s a first pass through some algorithms worth recognizing.
| Category | Algorithms | What are they for? |
|---|---|---|
| Sorting | QuickSort, Merge Sort, Timsort | Sorting data efficiently |
| Searching | Binary Search, DFS, BFS | Finding elements or traversing structures |
| Graphs | Dijkstra, A* | Finding paths and routes |
| Security | RSA, SHA-256 | Protecting communications and validating integrity |
| Compression | Huffman | Reducing size without losing information |
| Web & AI | PageRank, backpropagation | Ranking, machine learning |
Sorting Algorithms
Sorting data is one of the most repeated tasks in computer science. Customer lists, search results, dates, scores, files… everything gets sorted sooner or later.
Bubble Sort
Bubble Sort is taught a lot because it’s very easy to understand. It compares neighboring elements and swaps them if they are in the wrong order.
Large elements “bubble” towards the end of the list.
- Typical complexity:
O(n^2). - Advantage: simple to learn.
- Disadvantage: slow for large lists.
QuickSort
QuickSort uses the divide and conquer strategy. It chooses a pivot, places smaller values on one side and larger values on the other, and repeats the process on each sublist.
In practice, it is usually very fast, although its classic worst-case is O(n^2) if pivots are chosen poorly.
- Average complexity:
O(n log n). - Advantage: very fast in many real-world scenarios.
- Disadvantage: not stable in its common versions.
Merge Sort
Merge Sort also divides the list into chunks, sorts each part, and then merges them together.
Its great strength is that it has very predictable behavior and can be stable.
- Complexity:
O(n log n). - Advantage: stable and consistent.
- Disadvantage: usually requires
O(n)auxiliary memory.
When you call sort() in a modern language, it usually runs a highly optimized variant, sometimes hybrid. For example, Python uses Timsort, which combines ideas from Merge Sort and Insertion Sort.
Searching Algorithms
Once we have data, we want to find things. And here are some algorithms worth keeping in mind.
Binary Search
Binary search finds an element in a sorted list by dividing the search space in half at each step.
It’s like looking up a word in a paper dictionary. You don’t start on the first page; you open it to the middle and discard entire blocks.
- Complexity:
O(log n). - Requirement: the collection must be sorted.
DFS
DFS (Depth First Search) traverses a tree or graph by going as deep as possible along one path before backtracking.
It’s useful for exploring mazes, traversing hierarchical structures, detecting cycles, or analyzing dependencies.
- Typical use: trees, graphs, backtracking.
BFS
BFS (Breadth First Search) first explores nearby neighbors and then moves further away.
In unweighted graphs, BFS finds the path with the fewest steps.
- Typical use: level-order routes, minimum distance in unweighted graphs.
Path and Graph Algorithms
Graphs appear everywhere: maps, social networks, task dependencies, internet packet routes, decision trees…
Dijkstra
Dijkstra’s algorithm finds the shortest path from a source node to all other nodes in a graph with non-negative weights.
It’s one of those ideas that appears in maps, networks, and planning systems.
- Typical use: routes, networks, minimum costs.
- Caution: does not work correctly if there are negative weights.
A*
A* is a pathfinding search that uses a heuristic to prioritize routes that seem to get closer to the destination.
Dijkstra explores more uniformly. A* tries to go with a bit more intention, as long as the heuristic is well chosen.
- Typical use: video games, maps, robotics.
Security Algorithms
Without cryptographic algorithms, the internet would be a rather uncomfortable place to shop, log in, or send private information.
RSA
RSA is an asymmetric cryptography algorithm. It uses a public key to encrypt or verify, and a private key to decrypt or sign.
Its security relies on the difficulty of factoring very large numbers, although in modern systems it is often combined with other algorithms within broader protocols.
- Typical use: key exchange, digital signatures, certificates.
Hashing
Hash algorithms transform data of any size into a fixed-size fingerprint.
They are not used for “decrypting” later. They are used to check integrity, compare data, or store passwords more securely (always with salt and appropriate algorithms for passwords).
- Examples: SHA-256, SHA-3, BLAKE2.
- Caution: MD5 and SHA-1 are no longer considered secure for cryptographic uses.
Compression Algorithms
Compression aims to represent the same information using less space.
Huffman Coding
Huffman is a lossless compression algorithm.
It assigns shorter codes to more frequent symbols and longer codes to rare symbols. This reduces the total size without losing information.
- Typical use: text compression and as a component within larger formats.
Web and Artificial Intelligence Algorithms
We finish with two names that appear frequently when discussing the modern web and AI.
PageRank
PageRank was one of the ideas that made Google stand out in its early years.
It models the web as a graph of links. A page is important not just because it has many keywords, but because other important pages link to it.
- Main idea: links act like votes, but not all votes count equally.
Backpropagation
Backpropagation is the algorithm that allows training neural networks by adjusting their weights based on the error made.
It uses differential calculus, specifically the chain rule, to distribute the error backward through the network.
- Typical use: training neural networks.
