1/25
Looks like no tags are added yet.
The advantage of a linear search is that
it is simple and it can be used on unordered data
A linear search starts at the beginning and checks each item one at a time
A(n)_____ search is more efficient than a(n)_______ search.
binary, linear
A linear search checks one value at a time (doesnt have to be stored data)
A binary search keeps eliminating half of the remaining values (requires sorted data)
The linear search is adequate for searching through ______ arrays but not through _____ ones.
small, large
linear may have to check every element
5 elements easy, short
10000 elements harder, longer
Using a linear search you are more likely to find an item than if you use a binary search
FALSE
binary is more efficent and faster
A binary search begins by examining the _____ element of an array
middle
If the item being searched for is not in the array, binary search stops looking for it and reports that it is not there when
array infex first > array index last
this means there are no elements left to search
When searching for an item in an unordered set of data, binary search can find the item more quickly than linear search
FALSE
binary requires sorted/ordered data
A search can be performed on an array of
integers, strings objects, whether the data is in order or not
a sorting algorithm can be used to arrange a set of ____ in ____ order
numeric or string values ascending or descending,
the _____ sort usually performs fewer exchanges than the ______ sort
selection, bubble
bubble sort swaps values constantly
selection sort finds the smallest value and usually makes one exchange
to find a value that is in an unordered array of 100 items, how many values must linear seach examine on average?
50
linear search starts at the beginning but the value can be anywhere
to determine that an item is not in an unordered array of 100 items, how many values must linear search examine on average?
100
to find a value in an ordered array of 100 items how many values must binary search examine at most?
7
binary search keeps cutting the search area apporximately in half
100 → 50 → 25 → 12 → 6 → 3 → 1
When sorting an array of objects or structures one must decide which data item to sort on
True
When sorting an array of objects, if the values in the data member being sorted on are out of order for two objects, it is nececessary to
swap the entire two objects
if sorting highest girst, swap other data
Bubble sort and selection sort can also be used with STL vectors
TRUE
algorithms arent exclusive to arrays
We can measure the complexity of an algorithm that solves a computational problem by determining the number of _____ for an input size of n
basic steps it requires
Algorithm efficiency is measured by how many basic steps are needed as the input gets larger