Ch8. C++
given an array with 1,000 elements using a linear search it might take as many as ________ (on average) to find the target value in a worst case scenario
500
typically, for an array of N items a linear search will find the target value in ________
N/2 attempts
A binary search begins with the ________ element of an array.
middle
in a linear search ________ is the average number of comparisons
N/2 where N is the number of elements in the array
________ algorithms are used to arrange random data into some order.
Sorting
A(n) ________ search is more efficient than a ________ search.
binary, linear
_________ is inefficient for large arrays because items only move by one element at a time
bubble sort
every time a binary search makes a comparison it ________
eliminates half of the remaining portion of the array that has yet to be searched
Data that is sorted in ascending order is ordered ________.
from lowest to highest value
if an array is sorted with values from lowest to highest it is said to be sorted __________
in ascending order
if an array is sorted from highest element to lowest then it is said to be _______
in descending order
while the big advantage of a linear search is its simplicity its big disadvantage is that _________
it is very inefficient
A(n) ________ search uses a loop to sequentially step through an array.
linear
given an array with 1,000 elements it could be estimated that it would take ________ comparisons to search the array in the worst case scenario
no more than 10
The advantage of a linear search is its ________
simplicity
Array elements must be ________ before a binary search can be performed.
sorted
_________ are used to arrange data in some order
sorting algorithms
if you want to change a value in a vector argument it must be passed into _________
a reference parameter
_________ are used to calculate the maximum number of comparisons the binary search will make on an array of any size
powers of 2
A ________ algorithm is a method of locating a specific item of information in a larger collection of data
search
a ______ is a method of locating a specific item in a larger collection of data
search algorithm
The ________ sort usually performs fewer exchanges than the ________ sort.
selection, bubble