Question: Regarding the JAVA language consider the following questions about sorting: 1: Different sorting algorithms produce the same result when sorting an array. The choice of
Regarding the JAVA language consider the following questions about sorting:
1: Different sorting algorithms produce the same result when sorting an array.
The choice of algorithm is important, however, because it affects ________ of the program. (pick one)
a. only the run time
b. only the memory use
c. the run time and memory use
d. neither the run time nor the memory use
2: It is possible to sort an array primitives (int, float, double, etc.) but not an array of objects.
a. true
b. false
3: What does the first pass of selection sort do? (pick one)
a. splits the array into two approximately equal pieces.
b. orders the first two elements of the array.
c. partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element.
d. locates the smallest element in the array and swaps it into the zeroth position.
4: What is the efficiency of selection sort? (pick one)
a. O(n2)
b. O( n )
c. O(n logn)
d. O(1)
5: What does each iteration of the insertion sort algorithm do? (pick one)
a. sorted subarrays are inserted into the larger array.
b. each iteration takes the next smallest element and inserts it at the beginning of the array.
c. each iteration determines the location of a pivot and inserts it into place.
d. each iteration takes the next element in the unsorted portion of the array and inserts it into the sorted portion.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
