Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Constant, linear, quadratic cost » ?

Definition 17.4 High School Computer Science · Chapitre 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.
Lire dans le chapitre →