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.
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
- A* search
- Abstract data type
- Adjacency list
- Adjacency matrix
- Algorithm
- Amortized analysis
- Approximation algorithm
- Array
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.