Computer Science : Selection Sort

Study concepts, example questions & explanations for Computer Science

varsity tutors app store varsity tutors android store

Example Questions

Example Question #31 : Standard Operations & Algorithms

What is the worst-case run-time of selection sort (in Big-O notation?)

Possible Answers:

Correct answer:

Explanation:

Selection sort is comprised of outer and inner for loops that swap elements of the unsorted array into a sorted array. The largest possible number of times each loop can run is the number of elements in the array. Thus, the worst possible run time is .

Example Question #1 : Sorting

True or False.

 

Selection sort is quicker than MergeSort.

Possible Answers:

False

True

Correct answer:

False

Explanation:

MergeSort is has a running time of O(N). Selection sort has a running time of O(N2). Selection sort has O(N2) comparisons due to the swap in the algorithm. 

Learning Tools by Varsity Tutors