Technology keeps moving and new products keep appearing, but underneath most of them sit a small number of well understood algorithms. Knowing which family a problem belongs to is often more useful than remembering the exact implementation, because it tells you what to search for and what trade-off you are making.
Here are nine groups that come up again and again in programming and web development.
1. Search algorithms
Search algorithms apply to two kinds of data structure: linear ones (arrays, lists) and graph shaped ones (graphs, trees).
Linear search walks through every element until it finds the value. It does not require sorted data, and in exchange the complexity is O(n).
Binary search is a different beast and only works on sorted data. It halves the search range each step, so complexity is O(log n). This is also the idea behind git bisect: halve the commit history to find the commit that broke things in a few steps instead of checking each commit one by one.
For graphs and trees the two foundational algorithms are DFS (depth first search) and BFS (breadth first search). BFS explores layer by layer, so it finds the shortest path in an unweighted graph. It shows up in routing problems and in web crawlers.
2. Sorting algorithms
Sorting puts data into a defined order. QuickSort compares elements to decide their order, reaching O(n log n) on average but degrading to O(n²) with a bad pivot choice. MergeSort keeps O(n log n) in every case and is stable, at the cost of extra memory.
Radix sort runs in O(n·k) where k is the number of digits in the key. That sounds faster, but it is not a universal replacement: it only works when keys are integers or fixed length strings, and the constant factor is usually large. In other words, radix sort is not always faster than QuickSort, and the choice depends on your data type.
In practice you rarely implement these yourself. Every language’s built-in sort already uses a hybrid algorithm (Timsort in Python and Java, introsort in C++). You learn them mostly so you can tell when you need a different data structure instead of re-sorting from scratch.
3. Dynamic programming
Dynamic programming solves a complex problem by breaking it into smaller subproblems, solving those, and building the answer back up from the stored results. The key ingredient is memoisation: results of subproblems already solved are kept, so the next time the same subproblem appears it is answered instantly.
You meet this pattern more often than you expect: computing a diff between two texts, cache invalidation with overlapping dependencies, or any pricing rule where the total for a range can be built from totals of smaller ranges.
4. Link analysis
Common in network and graph work, link analysis measures the relationship between entities in a domain. It uses a graph representation plus matrix operations to connect related nodes.
Search engines like Google built their ranking on this idea, and social platforms use it for suggesting connections and surfacing content.
5. Modular arithmetic
Plenty of cryptographic algorithms look intimidating until you look at them through modular arithmetic, and then they get simple. In modular arithmetic you only deal with integers, using addition, subtraction, multiplication and division. The one difference from ordinary arithmetic is that every operation happens with respect to a positive integer, the modulus.
Examples worth knowing:
- The Euclidean algorithm and the extended Euclidean algorithm
- Euler’s theorem and Euler’s totient function
- Modular exponentiation
- Modular multiplicative inverse
- The Chinese remainder theorem
6. String matching and parsing
Matching patterns inside text matters constantly in web work. These algorithms earn their keep when you need to find a substring inside a long sequence, or validate input by parsing it against a defined grammar. URL routing, template engines and form validation all sit on this family.
7. Fourier transform algorithms
The Fourier transform and the fast Fourier transform are simple ideas with enormous reach. They convert a signal from the time domain to the frequency domain and back. Digital networks in general, the internet, WiFi, phones, computers, routers, satellites, all rely on this to work. If you go deep into electronics, computing or telecommunications, these are unavoidable.
8. Disjoint sets
A disjoint set is a helper data structure that represents multiple sets inside a single array, where each item belongs to exactly one set. It is what you reach for when you need to answer “are these two things connected?” quickly, which makes it a building block in graph algorithms and in image segmentation.
9. Integer factorisation
Integer factorisation is the problem of splitting a composite number into a product of primes. What matters here is that nobody has found an algorithm running in polynomial time on a classical computer for sufficiently large numbers, and that difficulty is exactly what RSA security is built on: multiplying two large primes is easy, going backwards is close to impossible.
This is also why quantum computing gets so much attention: Shor’s algorithm solves this problem in polynomial time, so if a large enough quantum computer ever exists, RSA stops being safe.
Those are the nine families. You will not implement most of them by hand, but recognising which one a problem belongs to is what turns a hard problem into a search query.