# Search algorithms at a glance: five methods visualised

> Every search method on this site in one place: linear, binary, ternary, jump and interpolation search. Each with its own visualisation, pseudocode and runtime.

Address: https://marckimmel.de/en/informatik/suchalgorithmen
Deutsche Fassung: https://marckimmel.de/informatik/suchalgorithmen.md

Linear, binary, Jump, Interpolation and Ternary Search with lo/mid/hi pointers on a sorted bar array.

## Topics

- [Linear Search](https://marckimmel.de/en/informatik/suchalgorithmen/lineare-suche.md): Interactive linear search: compares every index to the target value one after the other. Works on unsorted arrays and streams, runs in O(n) worst case.
- [Binary Search](https://marckimmel.de/en/informatik/suchalgorithmen/binaere-suche.md): Interactive binary search: halves the search range using the middle and shifts lo or hi. Requires a sorted array, runs in O(log n) with constant extra memory.
- [Jump Search](https://marckimmel.de/en/informatik/suchalgorithmen/jump-suche.md): Interactive Jump Search: jumps through a sorted array in √n strides and then scans the right block linearly. A sweet spot between O(n) and O(log n).
- [Interpolation Search](https://marckimmel.de/en/informatik/suchalgorithmen/interpolations-suche.md): Interactive interpolation search: estimates the target position via linear interpolation. Extremely fast on uniformly distributed values, worst case still O(n).
- [Ternary Search](https://marckimmel.de/en/informatik/suchalgorithmen/ternaere-suche.md): Interactive ternary search: splits the range at m1 and m2 into three parts. O(log₃ n), asymptotically like binary search, typical for unimodal functions.

## Comparison of the algorithms

| Algorithm | Best case | Average case | Worst case | Extra space |
|---|---|---|---|---|
| Linear Search | O(1) | O(n) | O(n) | O(1) |
| Binary Search | O(1) | O(log n) | O(log n) | O(1) |
| Jump Search | O(1) | O(√n) | O(√n) | O(1) |
| Interpolation Search | O(1) | O(log log n) | O(n) | O(1) |
| Ternary Search | O(1) | O(log n) | O(log n) | O(1) |

## Related

- [Computer science](https://marckimmel.de/en/informatik.md)
