n which scenario would selection sort perform worse compared to other sorting algorithms?

  • When sorting a dataset with random elements
  • When sorting a large dataset
  • When sorting a nearly sorted dataset
  • When sorting an already sorted dataset
Selection sort performs worse in nearly sorted datasets because it makes the same number of comparisons and swaps as in completely unsorted data, leading to suboptimal performance in already partially ordered lists.
Add your answer
Loading...

Leave a comment

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