In computer design, an algorithm is a finite, precisely specified procedure that transforms inputs into outputs by a sequence of unambiguous steps, and the condition that matters is that the procedure must terminate and be definite enough to be carried out mechanically—whether by a person, a compiler-generated machine code routine, or dedicated hardware. The phrase "in computer design" is broader than it may first appear: it covers algorithm design in software (data structures, sorting, searching, graph traversal) and also algorithm-level thinking in hardware design (adders, schedulers, arbitration logic, error correction). Software and hardware engineering both ask the same core question—what steps, in what order, produce the required result within the stated constraints?—but the artifacts differ.
The defining properties and why each matters
An algorithm is not merely "code." Code is one possible implementation of an algorithm; the same algorithm can be implemented in Python, in C, as a database query plan, or as a hardware state machine. The properties usually listed for algorithms are:
Finiteness: it must stop after a finite number of steps for every permitted input. A procedure that loops forever on some input fails as an algorithm, even if it is useful as a process. Definiteness (precision): each step must be unambiguous; there must be no reliance on judgment or interpretation at execution time. Input and output specification: the permitted inputs and the required outputs must be stated, including edge cases such as empty input. Effectiveness: each step must be simple enough to be carried out in practice with the available operations.
These properties are what separate an algorithm from a heuristic, a rule of thumb, or a specification of a problem. "Sort these records" is a problem statement. "Repeatedly compare adjacent pairs and swap them when out of order until no swaps occur" is an algorithm (bubble sort), and it satisfies finiteness because each pass reduces the number of inversions until none remain.
Algorithm versus program, data structure, and heuristic
A common confusion is treating algorithm, program, and data structure as synonyms. They are related but distinct:
An algorithm is the abstract method. A data structure is a way of organizing data that makes particular operations efficient—an array, a linked list, a hash table, a balanced tree. A program is a concrete expression of an algorithm in a language, together with whatever data structures and I/O handling the implementation requires.
A counterexample makes the distinction concrete. Binary search is an algorithm. Its requirement—random access to a sorted array—is a property of the chosen data structure. Implement binary search on a sorted linked list and the algorithm is still correct in principle, but its complexity changes, and the practical performance collapses; the "algorithm" did not change, the cost model did.
Similarly, a heuristic such as "check the most recently used cache entry first" is not a general algorithm for producing a correct answer; it is a strategy that usually works but has no guarantee. Design work often needs both: algorithms for the guaranteed parts and heuristics for the parts where exact solutions are too expensive.
The hardware side: algorithms as structures
In computer design beyond software, an algorithm can be a circuit. The steps of a ripple-carry adder correspond directly to the recurrence: sum bit = a XOR b XOR carry-in, carry-out = majority(a, b, carry-in), applied from least significant to most significant bit. That recurrence is an algorithm, and its hardware realization is a chain of full adders. A carry-lookahead adder computes the same function by a different algorithm—one that trades more gates and wider fan-in for lower delay. This is the essential pattern in hardware: different algorithms for the same function have different area, delay, and power costs, and the design decision is which resource to spend.
The same applies to control. A finite state machine is an algorithm encoded as states and transitions; an arbiter that grants a shared bus to one requester per cycle is an algorithm with fairness properties; an error-correcting code encoder and decoder are algorithms whose correctness and latency determine memory and link reliability. The abstract step sequence and the physical implementation are separable in theory, but in hardware the separation is narrower because the "steps" happen concurrently and the timing constraints are part of the specification.
Complexity: the part that makes algorithms a design discipline
Algorithm design is largely the study of resource growth as input size grows. The standard notation:
O(f(n)) describes an upper bound on growth (with the usual technical qualifications about constants and sufficiently large n). Ω(f(n)) describes a lower bound. Θ(f(n)) describes a tight bound when both apply.
These are asymptotic statements, not stopwatch measurements. That matters in practice: an O(n log n) sort with a large constant can be slower than an O(n²) sort on small arrays, which is why production sort implementations often switch to insertion sort for short subarrays. The algorithm's asymptotic class tells you what happens as inputs scale; the constants and the machine characteristics tell you what happens at the sizes you actually have.
Concrete comparison: searching a sorted array by binary search is Θ(log n) comparisons, while linear scan is Θ(n). For n = 1,000,000 the difference is enormous in the abstract, yet linear scan can win if the data are tiny (n = 8) or if the comparison is extraordinarily cheap and memory locality favors a linear sweep. Neither algorithm is "better" without a cost model and an input distribution.
A caution about claims: numerical complexity figures are model-dependent, and any specific runtime on specific hardware would require measurement, which this answer does not claim to have performed. What is stable is the growth classification and the reasoning about which costs dominate.
Correctness, termination, and the limits of guarantee
Algorithm design distinguishes correctness (the output satisfies the specification for every permitted input) from termination (it stops) and from performance. Proof techniques include loop invariants, induction, and, for recursive algorithms, well-founded orderings that guarantee progress toward a base case.
The halting problem is the classic limiting result: there is no general algorithm that decides, for every program and input, whether that program halts. This does not mean termination cannot be established for particular programs; it means no universal decision procedure exists. Designers handle this by restricting the problem—type systems, termination checkers, bounded loops in real-time systems—so that the question becomes decidable within the restricted domain.
Distinguish also exact algorithms from approximation algorithms with guarantees and from randomized algorithms whose correctness or runtime is probabilistic. A randomized quicksort is correct with probability 1 in the sense that it always sorts, but its expected running time is what is analyzed. These are genuinely different contract types, and conflating them is a common source of confusion.
Where ambiguity enters
The question "what is an algorithm in computer design" has an ambiguity worth naming early: computer design can mean computer architecture (designing processors and systems) or, more loosely, the design of computing systems including software. Under the architecture reading, algorithms appear as datapath and control structures; under the software reading, they appear as procedures and data-structure operations. Both readings are legitimate and the core definition is the same. What is not answerable from the query alone is which specific design context the asker has in mind—there is no supplied passage, choice list, jurisdiction, edition, or date-bearing ruleset to constrain the answer, so the answer above covers the stable, general definition and its standard distinctions rather than a version-specific standard.
Worked example: the same function, three algorithms
To make the design trade-off concrete, consider computing the greatest common divisor (GCD) of two non-negative integers.
Euclid's algorithm (subtraction form): while a ≠ b, replace the larger with the difference. Finite, correct, but can take many steps when one number is much larger. Euclid's algorithm (modulo form): while b ≠ 0, set (a, b) = (b, a mod b). Fewer iterations; the standard textbook form. Binary GCD: strip common factors of two, then use parity-based reductions. Uses no division, which matters on hardware where division is expensive.
All three compute the same function; they differ in operation mix and iteration count. This is exactly the kind of choice algorithm design is about: the specification (compute gcd) is fixed, and the algorithm is chosen to fit the cost model—division cost, shift cost, memory access, or gate count. In hardware, the binary form's avoidance of division is often decisive; in a high-level language, the modulo form's brevity and clarity usually win.
A counterexample to a tempting shortcut: "just divide until you find a common factor" is not Euclid's algorithm and is not efficient; trial division up to the smaller number is dramatically slower for large inputs. The presence of a loop does not make something a good algorithm, and finiteness alone does not make it practical. Both properties matter, and neither substitutes for the other.
Related terms and how they are used in sentences
Algorithmic (adjective): "The algorithmic complexity of the join depends on whether an index exists." Register: technical, neutral. Algorithmically (adverb): "The scheduler allocates bandwidth algorithmically rather than by fixed priority." Slightly formal. Heuristic: "The router uses a heuristic to pick a path quickly, then refines it." A heuristic is not an algorithm in the strict sense because it lacks a correctness guarantee. Procedure/routine/function: implementation-level terms; a procedure may implement an algorithm, but "procedure" alone does not assert finiteness or correctness. Pseudocode: a notation for expressing algorithms without committing to a language; it is a description, not an executable program.
Regional and register notes: In American English technical writing, "algorithm" is standard in both software and hardware contexts. "Algo" as an informal shortening appears in trading and some engineering slang (for example, "algo trading"), where it carries a specific industry meaning—automated rule-based trading—that should not be generalized back to computer design. Figurative uses ("the algorithm decided") treat an algorithm as an agent; in design discussion, keep the literal sense: the algorithm does not decide, the system executing it does, and the designers chose the rules.
What this answer does and does not establish
It establishes the stable definition, the standard properties, the relationship to programs and data structures, the role of asymptotic analysis, and the way algorithms appear in hardware design. It does not and cannot establish the contents of any particular textbook's definition, any specific course's required formalism, or any version-specific standard, because no source material was supplied and no browsing was available. Any claim about a specific named algorithm's exact runtime on a specific machine would require measurement, which is not claimed here. Where the question implies a specific design context—say, a particular processor family or a particular programming language's standard library—that context is absent and the corresponding specifics are unknown rather than guessed.