Consider the following sorting algorithms:

5. The following function, which is intended to sort an array into ascending order,
contains four serious mistakes.
What are they?
void sort (apvectorlist) { double copy; int n = list.length( ); for (int j = 0; j < n - 1; j++) for (int k = j + 1; k < n; k++) if (list[j] < list[k]) // if smaller copy = list[k]; list[k] = list[j]; list[j] = copy; }
MATCHING: Name the Sort:

(A) Straight Selection sort
(B) Selection sort with temporary variable
(C) Insertion sort
TRUE / FALSE
T F 1. A sequential or linear search is not always slower than a binary search for an item in an ordered list.
T F 2. A linear search for an item is slowest when the item sought is at the end of a list.
T F 3. Both binary searching and linear searching of an ordered list rely on different forms of trial-and-error to locate a list item.
T F 4. Binary searching works best with unordered lists.
T F 5. The maximum number of comparisons made by a linear search of a list of n items is 1 + log2N.
T F 6. Linear searching works better with ordered lists.
COMPLETION