← All topics
Quiz: Sorting Basics: questions with answers
13 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. Which simple sort is fastest on an array that is already almost sorted?
- Q3. Which of these sorts is NOT stable in its usual form?
- Q4. What is the best-case time of bubble sort with the "stop if no swap" check?
- Q5. You must sort an array where every write to memory is very costly. Which simple sort writes the least?
- Q6. How much extra memory do bubble, selection and insertion sort need?
- Q7. After the FIRST pass of bubble sort on [5, 1, 4, 2, 8], what is the array?
- Q8. An array has 100,000 items. Why is insertion sort a poor choice here?
- Q9. What does this print? (code)
- Q10. After the FIRST pass of selection sort on [29, 10, 14, 37, 13], what is the array?
- Q11. At most how many swaps does selection sort make on n items?
- Q12. Why is the largest value always at the end after the first pass of bubble sort?
- Q13. For which input does insertion sort do the most work?