Question: Selection Sort is a common algorithm to sort the elements of an array. First, it scans the elements of the array to find the smallest

Selection Sort is a common algorithm to sort the elements of an array. First, it scans the elements of the array to find the smallest value and places it at index 0, thus creating a sorted subarray of size 1 that contains the smallest value. Then it scans the remaining unsorted values for the new smallest value and places it at index 1, creating a sorted subarray of size 2 that contains the 2 smallest values. It continues in this way until the sorted subarray grows to contain all of the array elements, and therefore the entire array is sorted. Based on this description, what is the best big O estimate for Selection Sort? (Try to think about this for a bit before looking up the solution)

O(n)

O(log n)

O(n log n)

O(n2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!