Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Best case, worst case?

Ook bekend als: best case · worst case

Definition 17.3 High School Computer Science · Hoofdstuk 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.
Lees in het hoofdstuk →