Chapter 9: Problem 1
The ___________ search algorithm steps sequentially through an array, comparing each item with the search value.
Chapter 9: Problem 1
The ___________ search algorithm steps sequentially through an array, comparing each item with the search value.
All the tools & learning materials you need for study success - in one app.
Get started for freeThe____________ search algorithm repeatedly divides the portion of an array being searched in half.
If an array is sorted in ____________ order, the values are stored from lowest to highest.
The maximum number of comparisons that a binary search function will make when searching for a value in a 2,000 -clement array is ___________.
A binary search will find the value it is looking for with just one comparison if that value is stored in the ____________ array element.
Complete the following table by calculating the average and maximum number of comparisons the linear search will perform, and the maximum number of comparisons the binary search will perform. $$\begin{array}{l|lllll} & 50 & 500 & 10,000 & 100,000 & 10,000,000 \\ \text { Array Size } \rightarrow & \text { Elements } & \text { Elements } & \text { Elements } & \text { Elements } & \text { Elements } \\ \hline \begin{array}{l} \text { Linear Search } \\ \text { (Average Comparisons) } \end{array} & & & & & \\ \hline \begin{array}{l} \text { Linear Search } \\ ( \text { Maximum Comparisons) } \end{array} & & & & & \\ \hline \begin{array}{l} \text { Binary Search } \\ ( \text { Maximum Comparisons) } \end{array} & & & & & \\ \hline \end{array}$$
What do you think about this solution?
We value your feedback to improve our textbook solutions.