Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Best case, worst case » ?

Aussi appelé : best case · worst case

Definition 17.3 High School Computer Science · Chapitre 17 — The Cost of an Algorithm

For a given input size nn, the best case of an algorithm is an input of size nn on which its cost is the smallest, and the worst case one on which it is the largest. The cost in the worst case is a promise: no input of that size costs more.

Insertion sort on six elements. Sorted: every new element is checked once against its left neighbour. Reversed: the last one, 1, is compared with all five before it on its way to the front.
Insertion sort on six elements. Sorted: every new element is checked once against its left neighbour. Reversed: the last one, 11, is compared with all five before it on its way to the front.
Lire dans le chapitre →