Search algorithmsCTRL K

Searching

· 6 algorithms · sorted array
Start with Linear search
// searching

Searching finds one value in a collection. On unsorted data you have to look at everything; on sorted data you can throw half away at each step.

These six algorithms trade preconditions for speed: linear search asks nothing, binary search needs order, interpolation search needs uniform values.

Linear search
binary search · n=40
midtargetfound

All algorithms

6
Each card runs its own algorithm