Back to blog

Algorithms vs AI: when the buzzword devours common sense

Algorithms vs AI: when the buzzword devours common sense

We live in the age of hype. Every week a new Artificial Intelligence tool promises to revolutionize some industry, and headlines pile up like dominoes. Everyone has "AI", "LLMs", "tokens" and "prompts" constantly on their lips. But there is an uncomfortable question that few dare to ask: do you really need AI to solve that problem?

The trendy hammer

There is a well-known cognitive bias: when you have a hammer, everything looks like a nail. Today that hammer is Artificial Intelligence. It doesn't matter if the problem is classifying data, generating recommendations, detecting anomalies, or simply sorting a list. The default answer from many technical teams (and even more from non-technical ones) is: "let's throw AI at it". The problem is not that AI is bad. The problem is that it gets applied where it doesn't belong, wasting computational resources, development time, and above all, money on tokens.

What a good algorithm can do that AI cannot improve

There are situations where a classical algorithm is not just sufficient, but superior in every relevant aspect:

  • Speed: A sorting algorithm like Quicksort or Mergesort has guaranteed O(n log n) complexity. No language model is going to sort a million records faster or cheaper.
  • Determinism: Algorithms are predictable. Given the same input, they always produce the same output. An LLM might hallucinate today what it answered correctly yesterday.
  • Cost: Running a hashing function, a decision tree, or Dijkstra's algorithm costs essentially zero. Every call to an AI API has a token cost that adds up.
  • Privacy: With a local algorithm, your data never leaves your infrastructure. With an external AI API, you are sending information to third parties.
  • Auditability: You can read, understand, and verify the code of an algorithm. A model with billions of parameters is, in practice, a black box.

Concrete cases where an algorithm wins hands down

Search and sorting: If you need to find the cheapest item in a list, a simple sort() or binary search solves it in milliseconds. You don't need a model. Data validation: Regular expressions, business rules, checksums. Fast, deterministic, free. Route calculation: Dijkstra, A*, or Bellman-Ford have been solving optimal routing problems for decades with mathematical guarantees. GPT is not going to find a better path between two nodes in a graph. Duplicate detection: A simple hash (SHA, MD5) or Levenshtein distance detects duplicates exactly and efficiently. Simple recommendations: Classic collaborative filtering, association rules (Apriori), or even a simple weighted scoring system. For many use cases you don't need a transformer. Data compression: Huffman, LZ77, RLE. Algorithms with decades of history that do their job optimally.

When does it actually make sense to use AI?

This is not about demonizing AI. It has enormous value when the problem is genuinely complex:

  • Understanding and generating natural language
  • Image or audio recognition in open-ended contexts
  • Synthesis of information from multiple unstructured sources
  • Problems where the solution space is impossible to encode manually

The key is asking the right question before you start: does this problem have a known algorithmic solution? If the answer is yes, use it. It will be faster, cheaper, more predictable, and easier to maintain.

Conclusion

AI is not the answer to everything. It is a powerful tool for specific problems, but the hype has created a culture where applying it is perceived as a sign of modernity and innovation, even when it is the worst solution for the problem at hand. A good engineer knows when to use a scalpel and when to use a hammer. And they also know that sometimes the best tool is simply a well-thought-out algorithm, written once, that works forever without spending a single token. At Redsauce we carry out audits to help you make this decision with confidence: we analyse your processes and tell you how, when and why to incorporate AI into your business — but also when not to. Because sometimes the best recommendation is not to use it at all. If you would like us to review your case, you can contact us with no obligation whatsoever. Elegance in programming is not about using the newest technology. It is about using the right technology.