### Quiz 7 Sorting Algorithms Practice

1. Sort the following array using each of the three sorting algorithms.
2. 26   48   12   92   28   6    33

• Selection Sort

• Insertion Sort

• Merge Sort

3. Which of the following sorting algorithms is shown in the sort below? (Choose all correct answers.)

8    73   89   20   94   83   58
8    73   89   20   94   83   58
8    73   89   20   94   83   58
8    73   89   20   94   83   58
8    73   20   89   83   94   58
8    20   73   89   58   83   94
8    20   58   73   83   89   94
• Selection Sort
• Insertion Sort
• Merge Sort
• None of the above

4. Which of the following sorting algorithms is shown in the sort below? (Choose all correct answers.)

51   11   56   83   20   26   33
11   51   56   83   20   26   33
11   20   56   83   51   26   33
11   20   26   83   51   56   33
11   20   26   33   51   56   83
11   20   26   33   51   56   83
11   20   26   33   51   56   83
• Selection Sort
• Insertion Sort
• Merge Sort
• None of the above

5. Which of the following sorting algorithms is shown in the sort below? (Choose all correct answers.)

83   5    8    12   65   72   71
5    83   8    12   65   72   71
5    8    83   12   65   72   71
5    8    12   83   65   72   71
5    8    12   65   83   72   71
5    8    12   65   72   83   71
5    8    12   65   71   72   83
• Selection Sort
• Insertion Sort
• Merge Sort
• None of the above

6. What are the advantages and disadvantages of each of the following sorting algorithms?
1. Selection Sort

2. Insertion Sort

3. Merge Sort

7. Which of the following sorting algorithms should you use to sort short arrays in a memory-limited real-time application?
• Selection Sort
• Insertion Sort
• Merge Sort

8. Which of the following sorting algorithms is most efficient for sorting arrays that are already mostly in order?
• Selection Sort
• Insertion Sort
• Merge Sort

9. Which of the following sorting algorithms is most efficient for sorting large arrays with values in random order?
• Selection Sort
• Insertion Sort
• Merge Sort
10. For searching an unordered list, which search algorithm is the better choice?
11. For searching an ordered list, which search algorithm is the better choice?
12. In what situations would the binary search algorithm be useful?
13. In what situations would the linear search algorithm be useful?
14. For an array of a million element, how many elements at most would you need to check using binary search in order to determine whether a specific element is in the array?
15. For a list of 100 elements, how many elements would you need to check using binary search in order to find out if a particular element is in the list?

Posted in apcsa