Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Best case, worst case?

Dikenal juga sebagai: best case · worst case

Definition 17.3 High School Computer Science · Bab 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.
Baca dalam konteks →