17

Search Algorithms and Linear Search

In the real world, when we talk about search or searching, we are trying to find something. We might be looking for a sock in a pile of clothes, a needle in a haystack, a matching fork to go with a knife, Waldo (and possibly his dog companion Woof), car keys, a particular star in our solar system, or a billion other things (Figure 17-1).

Images

FIGURE 17-1

Maybe they are real!

In our algorithmic digital world, when we talk about search or searching, we are still trying to find something. The key difference is that what we are trying to find will live in a collection of data, such as an array, a list, or a tree. ...

Get Absolute Beginner's Guide to Algorithms: A Practical Introduction to Data Structures and Algorithms in JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.