1. One of the strengths of computers is their ability to find things quickly. This ability is called ________.
2. Sequential or Linear search typically starts at the first element in an array or ArrayList and looks through all the items one by one.
3. Binary search can only be used on data that has been _____________________.
4. A Linear search can also operate only on data that is in order.
5. A Binary Search checks the ______________________is less than, equal, or greater than the desired value and then based on the results of that it narrows the search.
6. Sequential search is also called a _____________search.
7. Sequential search is the only method that can be used to find a value in _________________.
8. Which of the following statements is correct, regarding the following code?
9. Which of the following statements is correct, regarding the following code?
10. Which will cause the longest execution of a sequential search looking for a value in an array of integers?
11. Which will cause the shortest execution of a sequential search looking for a value in an array of integers?
12. It is also possible to look for a string in an array or list. But, when you look for a string be sure to use == rather than equals.
13. Binary search calculates the_______________ where left starts out at 0 and right starts out at the array length - 1 (the index of the last element).
14. Consider the following code for a binary search and the different tests at the bottom of the code. What is test 2 likely to be for?
15. Binary search is much slower than linear search, especially on large data sets, but it can only be used on sorted data.
16. Often with runtimes, computer scientist think about the ________ behavior. With searching, the ___________ is usually if you cannot find the item.
17. Which will cause the shortest execution of a binary search looking for a value in an array of integers?
18. Which of the following conditions must be true in order to search for a value using binary search?
19. How many times would the loop in the binary search run for an array int[] arr = {2, 10, 23, 31, 55, 86} with binarySearch(arr,55)?
20. If you had an ordered array of size 500, what is the maximum number of iterations required to find an element with binary search?