{ "q1": { "type": "blank", "question": "\n

Sorting algorithms often require swapping or switching\nvalues as part of the process of ordering values. Complete the following\ncode that implements a swap function for two ints:

\n\n
\nvoid swap(int *a, int *b) {\n    int tmp = ____;\n    ____ = ____;\n    ____ = tmp;\n}\n
\n" }, "q2": { "type": "order", "question": "\n

Given the following traces of arrays being sorted, identify the\nalgorithm used for each trace (the array is printed after each\niteration through the array):

\n\n
\nTrace 1:\n\n  5 7 4 0 1\n  5 7 4 0 1\n  4 5 7 0 1\n  0 4 5 7 1\n  0 1 4 5 7\n\nTrace 2:\n\n  5 7 4 0 1\n  0 7 4 5 1\n  0 1 4 5 7\n  0 1 4 5 7\n  0 1 4 5 7\n\nTrace 3:\n\n  5 7 4 0 1\n  5 4 0 1 7\n  4 0 1 5 7\n  0 1 4 5 7\n  0 1 4 5 7\n\n
\n", "responses": { "bubble_sort": "Bubble Sort", "insertion_sort": "Insertion Sort", "selection_sort": "Selection Sort" } }, "q3": { "type": "multiple", "question": "\n

Which of the following statements regarding the stability of\nsorting algorithms are true (select all that apply)?

\n", "responses": { "bubble_sort": "Bubble sort is considered a stable sorting algorithm.", "insertion_sort": "Insertion sort is considered a stable sorting algorithm.", "selection_sort": "Selection sort is considered a stable sorting algorithm.", "merge_sort": "Merge sort is considered a stable sorting algorithm.", "quick_sort": "Quick sort is considered a stable sorting algorithm." } }, "q4": { "type": "multiple", "question": "\n

Which of the following statements regarding the use of\ndivide-and-conquer in sorting algorithms are true (select all\nthat apply)?

\n", "responses": { "bubble_sort": "Bubble sort is considered a divide-and-conquer sorting algorithm.", "insertion_sort": "Insertion sort is considered a divide-and-conquer sorting algorithm.", "selection_sort": "Selection sort is considered a divide-and-conquer sorting algorithm.", "merge_sort": "Merge sort is considered a divide-and-conquer sorting algorithm.", "quick_sort": "Quick sort is considered a divide-and-conquer sorting algorithm." } }, "q5": { "type": "multiple", "question": "\n

Which of the following statements regarding the average time complexities\nof sorting algorithms are true (select all that apply)?

\n", "responses": { "bubble_sort": "Bubble sort has an average time complexity of O(nlogn).", "insertion_sort": "Insertion sort has an average time complexity of O(nlogn).", "selection_sort": "Selection sort has an average time complexity of O(nlogn).", "merge_sort": "Merge sort has an average time complexity of O(nlogn).", "quick_sort": "Quick sort has an average time complexity of O(nlogn)." } }, "q6": { "type": "multiple", "question": "\n

Which of the following statements regarding the average space complexities\nof sorting algorithms are true (select all that apply)?

\n", "responses": { "bubble_sort": "Bubble sort has an average space complexity of O(1).", "insertion_sort": "Insertion sort has an average space complexity of O(1).", "selection_sort": "Selection sort has an average space complexity of O(1).", "merge_sort": "Merge sort has an average space complexity of O(1).", "quick_sort": "Quick sort has an average space complexity of O(1)." } } }