Question: JAVA HOMEWORK 1.The choice of algorithm is important, however, because it affects ________ of the program. Select one: only the run time only the memory
JAVA HOMEWORK
1.The choice of algorithm is important, however, because it affects ________ of the program. Select one: only the run time only the memory use the run time and the memory use 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. Select one: True False
3. What does the first pass of selection sort do? Select one: Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element. Orders the first two elements of the array. Locates the smallest element in the array and swaps it into the zeroth position. Splits the array into two approximately equal pieces.
4. What is the efficiency of selection sort? Select one: O( n ) O(n2) O(1) O(n logn)
5. What does each iteration of the insertion sort algorithm do?
Select one:
Sorted subarrays are inserted into the larger array.
Each iteration takes the next element in the unsorted portion of the array and inserts it into the sorted portion.
Each iteration determines the location of a pivot and inserts it into place.
Each iteration takes the next smallest element and inserts it at the beginning of the array.
6. What is the efficiency of insertion sort? Select one: O( n ) O(n logn) O(1) O(n2)
7. Consider selection sort and insertion sort and how much memory these algorithms need in proportion to the size of the array. In other words, do not consider memory required for single variables or looping variables, only memory that is directly proportional to the array. Which of the following is true?
Select one:
Selection sort requires more additional memory than insertion sort.
Insertion sort requires more additional memory than selection sort.
Both selection and insertion sort require the same amount of additional memory.
Neither selection nor insertion sort require additional memory.
8.race a selection sort on the following array. 27 14 23 24 19 12 20 10
What is the contents of the array after the first pass of selection sort?
What is the contents of the array after the second pass of selection sort?
What is the contents of the array after the third pass of selection sort?
how many passes in total?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
