Created by Andrew Lewis
over 3 years ago
|
||
This type of algorithm rearranges the values stored in an array in some particular order.
If an array is sorted in this order, the values are stored from lowest to highest.
If an array is sorted in this order, the values are stored from highest to lowest.
This algorithm makes several passes through an array and causes the larger values to gradually move or "bubble" toward the end of the array with each pass.
In this algorithm, the smallest value in the array is located and moved to the element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order.
This algorithm sorts the first two elements which become the sorted part of the array. Then it inserts each of the remaining elements, one at a time, into the sorted part of the array at the correct location.
This search algorithm steps sequentially through an array, comparing each item with the search value. Best used for small array and not large ones.
This search algorithm repeatedly divides the portion of an array being searched in half. Each time it divides the array, it eliminates the half of the array that doesn't contain the item. Requires that all values in the array are in ascending order.
Between binary search and sequential search, which is more efficient.
True/False: Regardless of the programming language being used, it is not possible to use the bubble sort algorithm to sort strings.
True/False: The "average" number of comparisons performed by the sequential search algorithm on an array of "n" elements is "n/2" (assuming the search values are consistently found).
True/False: The "maximum" number of comparisons performed by the sequential search algorithm on an array of "n" elements is "n/2" (assuming the search values are consistently found).
True/False: To successfully swap the contents of two variables, we need to declare a third variable that can serve as a temporary storage location.
Assuming a temporary variable was made for the swap function, what are the following steps to swap the two values of variables "a" and "b"?