CalcWorldHub
Computer science · CalcWorldHub

Algorithm Input Growth Ratio: Compare Work Across Input Sizes

A polynomial growth ratio compares the same model at two input sizes: R = (n₂/n₁)ᵏ. If input grows from 100 to 1,000 and the chosen degree is 2, the modeled operation count grows by 100×. This is a scale comparison, not a benchmark or a prediction of exact seconds.

Open calculator
Three algorithm curves rise at distinct rates as input size increases.

Share this article

The model divides the second input size by the first, then raises that ratio to degree k.
The coefficient cancels when the same polynomial term is compared.

Define what the calculator compares

The fields are First input size, Second input size, and Polynomial degree. The first size must be positive, the second nonnegative, and the degree from 0 through 100. The calculator returns (second size / first size)^degree. This is a dimensionless ratio, not an operation count or elapsed time.

The model assumes one growth term of the form c·nᵏ is being compared at two sizes with the same coefficient c. Because c cancels in the ratio, the calculator needs no measured coefficient. If the two cases are different algorithms, implementations, data distributions, or machines, the coefficient may not be shared and the ratio can be misleading.

Apply the power ratio

Let n₁ be the first input size, n₂ the second, and k the chosen degree. The calculation first forms q = n₂/n₁, then raises q to k. With n₁ = 100, n₂ = 1,000, and k = 2, q = 10 and R = 10² = 100. The second case is one hundred times the modeled work for a quadratic term.

For k = 1, doubling input doubles the model; for k = 2, doubling gives four times; for k = 3, doubling gives eight times. A degree of zero returns one for positive sizes because a constant model does not grow with n. These are relative multipliers and should be described as such, not as a guaranteed number of machine operations.

Worked examples

Tenfold input under a quadratic model

Inputs: First size n₁ = 100; second size n₂ = 1,000; degree k = 2

Calculation: R = (1,000 / 100)² = 10²

The modeled polynomial term is 100 times as large at the second input size.

Doubling input under a cubic model

Inputs: First size n₁ = 1,000; second size n₂ = 2,000; degree k = 3

Calculation: R = (2,000 / 1,000)³ = 2³

The modeled cubic term grows by a factor of 8.

A tenfold increase in input yields illustrative multipliers of ten, one hundred, or one thousand for degrees one, two, and three.
The exponent determines how a size ratio scales.

Read the result as an asymptotic comparison

Polynomial degree is a simplified growth label. Actual algorithm analyses often use O, Ω, or Θ notation to describe upper, lower, or tight asymptotic bounds, and running-time functions can include constants and lower-order terms. This tool compares a single nᵏ term; it does not inspect code or establish that an algorithm really has that complexity.

Two algorithms with different degrees may behave differently on small inputs because constants, memory allocation, vectorization, caching, and startup costs matter. A quadratic routine with a small coefficient can beat a linear routine for a limited range. Use the ratio to reason about scale after identifying an appropriate model, then benchmark representative workloads when elapsed time matters.

Choose input sizes consistently

Input size must measure the same thing in both cases: records, elements, vertices, bytes, or another problem-specific unit. A ratio is dimensionless only because the same unit cancels. Comparing 100 records with 1,000 kilobytes mixes different definitions and does not give a meaningful growth ratio even though the arithmetic accepts the numbers.

The second size may be zero. For a positive degree, the modeled term is zero when n₂ = 0, so the calculator returns a zero ratio. If the degree is zero, the result is one even when n₂ is zero; treat that edge case as a mathematical convention rather than a useful workload comparison. For ordinary comparisons, use positive input sizes and state your assumptions.

Use the comparison to plan a test

A practical test plan can compare a baseline workload with a scaled workload. If n₂/n₁ = 2 and k = 3, expect an eightfold change in the modeled term; record the observed execution time separately and investigate differences rather than treating the model as a stopwatch. Repeating measurements and reporting the input shape can show whether the chosen exponent is plausible.

Check the ratio by reversing the sizes: when both are positive, R(n₁,n₂,k) × R(n₂,n₁,k) = 1. If n₂ is smaller than n₁ and k is positive, the result should be below one; if the sizes are equal, it should be one for every degree. Those checks catch swapped fields and help distinguish model comparison from an absolute workload estimate.

Sources and further reading

Share this article

Browse all articles · Calculator: Algorithm input growth ratio calculator