Recall the Due Dates and (from the syllabus) the Late (and early) Assignment Policy and guidelines for maintaining Academic Integrity.
Also recall that you can get help on any of these problems during the CSSE lab assistant hours, and you can use the Assignments Discussion Forum on Angel to discuss, clarify, or get help on these problems.
Write your answers to these questions. Turn your answers in via the appropriate Homework Drop Box on Angel.
X: 13 94 10 17 12 35 Step 1: Pick X[1], which is 94. Insert it, working backwards, to get 13 94. Step 2: Pick X[2], which is 10. Insert it into 13 94, working backwards, to get 10 13 94. Step 3: Pick X[3], which is 17. Insert it into 10 13 94, working backwards, to get 10 13 17 94. Step 4: Pick X[4], which is 12. Insert it into 10 13 17 94, to get 10 12 13 17 94. Step 5: Pick X[5], which is 35. Insert it into 10 12 13 17 94, to get 10 12 13 17 35 94. Done.Here is the code for Insertion Sort:
for(i=1; i < a.length; i++) {
temp = a[i];
j = i;
while (j > 0 && temp < a[j-1]) {
a[j] = a[j-1];
j--;
}
a[j] = temp;
}