CS Chap8
What must be true about an array before using binary search on that array?
The array must be sorted
When using binary search to locate an item in a list of n sorted elements, about how many comparisons are made?
about log(n) comparisons
When using sequential search to locate an item in a list of n randomly-ordered elements, about how many comparisons are made?
about n comparisons
When using exchange sort to put n randomly-ordered elements in ascending order, about how many comparisons are made?
about n^2 comparisons
A search algorithm that uses a "divide and conquer" approach is
binary search
When a binary search is conducted on an array with 1000 elements, at most ___ comparisons will be made.
10 comparisons
Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, ________ element(s) must be compared.
20,000
A linear search can only be implemented with integer values.
False
On average, bubble sort performs fewer comparisons than insertion sort.
False
________ algorithms are used to arrange random data into some order.
Sorting
When using sequential search on an array of length N, on average the algorithm will make N/2 comparisons.
True
When an array is sorted from highest to lowest, it is said to be in ________ order.
descending
Bubble sort is also known as ___
exchange sort
A binary search begins with the ________ element of an array.
middle
A ________ algorithm is a method of locating a specific item of information in a larger collection of data.
search
Which of these sorting algorithms performs the smallest number of exchanges?
selection sort
A(n) ________ search uses a loop to step through an unsorted array from beginning to end.
sequential
Array elements must be ________ before a binary search can be performed.
sorted