Question: 3. Consider an array of numbers, A[7] = {6, 8, 1, -3, 2, 7, -7}, B[7] = {1, 5, 4, 0, 3, 7, -1}
3. Consider an array of numbers, A[7] = {6, 8, 1, -3, 2, 7, -7}, B[7] = {1, 5, 4, 0, 3, 7, -1} and C[7]={12, 8, 1, -3, 16, 7, -7). You are asked to sort A and B in the ascending numeric order. Answer the following questions. (30%) a. Perform insertion sort on A for the first two iterations. You only need to write down the result of A after each iteration. a. Perform bubble sort on B for the first three iterations. You only need to write down the result of B after each iteration. b. Perform quicksort on C for up to two partitions. You are going to select the last element as the pivot and hide the pivot at the last position. You only need to write down the result of C after each partition. In addition, use a bracket to indicate the pivot of the corresponding partition.
Step by Step Solution
There are 3 Steps involved in it
Explore a Insertion Sort on Array A Array A 6 8 1 3 2 7 7 First Iteration Compare 6 and 8 No swap ne... View full answer
Get step-by-step solutions from verified subject matter experts
