Given a large array of several million elements of type 'double', you are asked to sort them in ascending order using an algorithm of your choice. You choose selection sort. Why is this a poor choice?
Group of answer choices
Selection sort can only sort elements of type 'int'
Selection sort requires 3x the memory of other sort algorithms
Selection sort can only work on an array with an odd number of elements
Selection sort will be prohibitively inefficient for large arrays
Selection sort can sort elements of type integer, float, and double data type as well therefore option A is incorrect.
The space complexity of selection sort is O(1) which is the least in comparison to other sorting algorithm, therefore it is incorrect to say that Selection sort requires 3x the memory of other sort algorithms, hence option B is also incorrect.
Selection sort can also work on an array with an even number of elements therefore option C is also incorrect.
Selection sort is a in-place comparison based sorting algorithm and if the array size increases then the comparison will also increased therefore selection sort is insufficient for the array of larger size, hence option D is correct.
Get Answers For Free
Most questions answered within 1 hours.