Engineered
Big O Notation

Algorithm Performance

Learn what algorithm is and why working solution is not always enough.

What is algorithm?

An algorithm is a step-by-step set of instructions or rules designed to solve a specific problem or perform a task. It takes an input, processes it through a sequence of defined steps, and produces an output.

Algorithm Performance

A solution can be correct and still perform poorly. Two algorithms may produce the exact same result while requiring vastly different amounts of work, time, or memory.

Performance matters because it helps us:

  • Compare algorithms that solve the same problem.
  • Identify trade-offs between possible solutions.
  • Debug code that is unexpectedly slow.
  • Explain and evaluate solutions in technical interviews.

Correctness is not the only concern

When multiple solutions are correct, performance provides another way to distinguish them.

Thinking about algorithm performance turns a question from only "Does this work?" into "How well does this work compared with other correct solutions?"


Key Takeaways

  • Beyond Correctness: A working solution is not necessarily an optimal one; performance dictates how well an application scales under real-world loads.
  • Resource Constraints: Algorithm efficiency is evaluated primarily across two dimensions: Time Complexity (execution speed) and Space Complexity (memory usage).
  • Engineering Trade-offs: Profiling algorithm performance allows engineers to make informed decisions when choosing between simplicity, memory efficiency, and raw speed.

How is this lesson?