Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Best case, worst case?

También llamado: best case · worst case

Definition 17.3 High School Computer Science · Capítulo 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.
Leer en el capítulo →