All AP Computer Science A Resources
Example Questions
Example Question #1 : Selection Sort
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 : Selection Sort
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.
All AP Computer Science A Resources
Popular Subjects
SSAT Tutors in San Francisco-Bay Area, Math Tutors in Houston, GRE Tutors in New York City, Spanish Tutors in Los Angeles, ACT Tutors in Philadelphia, Spanish Tutors in Houston, Chemistry Tutors in Los Angeles, Spanish Tutors in Washington DC, Calculus Tutors in Phoenix, Math Tutors in New York City
Popular Courses & Classes
GMAT Courses & Classes in Philadelphia, Spanish Courses & Classes in San Francisco-Bay Area, SAT Courses & Classes in Seattle, ISEE Courses & Classes in Miami, ACT Courses & Classes in Denver, MCAT Courses & Classes in Houston, MCAT Courses & Classes in Seattle, ISEE Courses & Classes in Seattle, ISEE Courses & Classes in San Diego, MCAT Courses & Classes in Atlanta
Popular Test Prep
LSAT Test Prep in Los Angeles, ISEE Test Prep in San Diego, SAT Test Prep in Denver, ACT Test Prep in Denver, LSAT Test Prep in San Diego, ISEE Test Prep in Phoenix, ACT Test Prep in Phoenix, LSAT Test Prep in Dallas Fort Worth, GRE Test Prep in Miami, GMAT Test Prep in Dallas Fort Worth