Question: (a) Trace insertion sort on the list 4, 9, 2, 1, 8, 3. i.e. show what the list looks like after each iteration of the

(a) Trace insertion sort on the list 4, 9, 2, 1, 8, 3. i.e. show what the list looks like after each iteration of the outer loop. Also, calculate the exact number of total data comparisons made. Note that a data comparison is when two different pieces of data are compared, and not when loop variables etc are compared.

(b) Trace the merge algorithm (not the complete merge sort) on the two lists 1, 3, 7, 19 and 2, 5, 8, 13. Show what the combined list (i.e. the merged list) looks like after every step and also calculate the exact number of total data comparisons made.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!