May 2019
Beginner
528 pages
29h 51m
English
Looking up a phone number, finding a website via a search engine and checking the definition of a word in a dictionary all involve searching large amounts of data. This section and Section 11.9 discuss two common search algorithms—one that’s easy to program yet relatively inefficient (linear search) and one that’s extremely efficient but more complex to program (binary search).
The linear search algorithm searches each element in an array sequentially. If the search key does not match an element in the array, the algorithm informs the user that the search key is not present. If the search key is in the array, the algorithm tests each element until it finds one that matches the search key and returns ...
Read now
Unlock full access