subalgorithm
A subalgorithm is an algorithm that is invoked by a larger algorithm to perform a well-defined task. It is designed as a modular component with a clear interface, taking input parameters and producing an output under specified preconditions. Subalgorithms may be used multiple times within the parent algorithm and can themselves call other subalgorithms.
Design and interfaces play a central role in subalgorithm development. Subalgorithms should be self-contained, with explicit
Complexity and analysis are influenced by subalgorithms through their cost and invocation count. The running time
Examples illustrate the concept. The Euclidean algorithm for greatest common divisor can be used as a subalgorithm
Relation to practice and terminology: subalgorithm emphasizes a building-block view within an algorithm, in contrast to