Can selection sort be used efficiently for sorting nearly sorted arrays? Why or why not?

  • It depends on the size of the array and available memory
  • No, it performs poorly on nearly sorted arrays
  • Yes, but only if the array is sorted in descending order
  • Yes, it is specifically designed for nearly sorted arrays
No, selection sort performs poorly on nearly sorted arrays because it always makes the same number of comparisons and swaps, regardless of the input order, making it less efficient for partially ordered lists.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *