Quiz Answer Key and Fun Facts
1. One of the simplest sorting algorithms is called bubble sort. Do you know why?
2. In which case would an insertion sort perform best, assuming it was reading the array to be sorted from beginning to end (as opposed to randomly)?
3. What is the first change that selection sort would make to this sequence to put it into ascending order: "3 1 4 2"?
4. A mergesort works by first breaking a sequence in half a number of times so it is working with smaller pieces. When does it stop breaking the list into sublists (in its simplest version)?
5. Quicksort works by choosing a pivot value and moving list elements around. Each element less than the pivot will be closer to the beginning of the list than the pivot, and each element greater than the pivot will be closer to the end of the list. By doing this operation many times with different pivots, the list will become sorted. For the fastest operation, which would be the best pivot value?
6. Which algorithm would work best to sort data as it arrives, one piece at a time, perhaps from a network?
7. Which of these sorting algorithms could easily be parallelized? (Given any number of extra computers to help with the task, which would require the least extra programming to have them work together to sort the list)?
8. When would it be a good idea to use bubble sort?
9. A 'stable' sort is a sort that will not change the relative order of any pair of equal values in a list. Which of these is (in its default implementation) *not* a stable sort?
10. Which of the following sorting algorithms cannot be performed in-place (it needs scratch-space apart from the array being sorted)?
Source: Author
Hegh
This quiz was reviewed by FunTrivia editor
crisw before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.