CS-1143 Chapter 8
What must be true about an array before using binary search on that array?
The array must be sorted
A search algorithm that uses a "divide and conquer" approach is
binary search
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 exchange sort to put n randomly-ordered elements in ascending order, about how many comparisons are made?
about n2 comparisons
When a binary search is conducted on an array with 1000 elements, at most ___ comparisons will be made.
10
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
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
When using sequential search to locate an item in a list of n randomly-ordered elements, about how many comparisons are made?
n comparisons
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