Output-sensitive algorithm
In computer science, an output-sensitive algorithm is an algorithm whose running time depends on the size of the output, instead of, or in addition to, the size of the input. For certain problems where the output size varies widely, for example from linear in the size of the input to quadratic in the size of the input, analyses that take the output size explicitly into account can produce better runtime bounds that differentiate algorithms that would otherwise have identical asymptotic complexity.
In computer science, an output-sensitive algorithm is an algorithm whose running time depends on the size of the output, instead of, or in addition to, the size of the input. For certain problems where the output size varies widely, for example from linear in the size of the input to quadratic in the size of the input, analyses that take the output size explicitly into account can produce better runtime bounds that differentiate algorithms that would otherwise have identical asymptotic complexity. def divide(number: int, divisor: int) -> tuple[int, int]: """Division by subtraction.""" if divisor == 0: raise ZeroDivisionError if number = divisor: q += 1 r -= divisor return q, r Example output: >>> divide(10, 2) (5, 0) >>> divide(10, 3) (3, 1) This algorithm takes Θ(Q) time, and so can be fast in scenarios where the quotient Q is known to be small. In cases where Q is large however, it is outperformed by more complex algorithms such as long division. ==See also== Lazy evaluation
References
No reference rows published for this article.
Cite this article
MLA
"Output-sensitive algorithm." encyclopegia.org, 2025, https://encyclopegia.org/wiki/output-sensitive-algorithm. Accessed 24 November 2026.
Chicago
"Output-sensitive algorithm." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/output-sensitive-algorithm.
APA
encyclopegia.org. (2025). Output-sensitive algorithm. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/output-sensitive-algorithm
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON