Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Constant, linear, quadratic cost?

Definition 17.4 High School Computer Science · Capítulo 17 — The Cost of an Algorithm

A cost is constant if it does not grow with nn; linear if it is about proportional to nn, so that doubling nn about doubles it; quadratic if it is about proportional to n2n^2, so that doubling nn about multiplies it by 44.

Worst-case counts, from figures/counts.py. At n = 100, 100 comparisons against 4950; the straight line is not zero, it only looks flat beside the parabola.
Worst-case counts, from figures/counts.py. At n=100n = 100, 100100 comparisons against 49504950; the straight line is not zero, it only looks flat beside the parabola.
Leer en el capítulo →