AI engineering glossary · Data structures algorithms

What is worst-case analysis?

Worst-case analysis (also called worst case): Measuring an algorithm's cost on the most unfavourable input of a given size. It gives a guarantee that the running time will never be worse than the bound, which matters for systems with strict response deadlines.

Level: intermediateTopic: Data structures algorithms

Worst-case analysis: an example

Quicksort with a poor pivot choice on an already sorted array takes O(n^2), even though its typical time is O(n log n).

Related terms

More Data structures algorithms terms

Where you learn it

Worst-case analysis is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.