Question 5* The letters of the word KNIGHTED form the list (Xi)1..8 = (K, N, I, G, H, T, E, D). This list is to be sorted into alphabetical order using Selection sort. The sorting is to be achieved by progressively modifying an index function π, rather than by shuffling members of the list itself. So initially (Xi)1..8 = (Xπ(i))1..8 where π = (1 2 3 4 5 6 7 8 / 1 2 3 4 5 6 7 8) and when sorting is complete π is sufficiently changed so that (Xπ(i))1..8 is in order. (a) First apply the Least Element algorithm to (Xi)1..8. Demonstrate the application by completing the trace table at right. (b) Write out the modified index function π resulting from (a). (c) Now apply the Least Element algorithm to (Xi)2..8 using this modified π, again demonstrating the application by a trace table. (d) Write out the newly modified index function π resulting from (c). (e) Without making trace tables, write out the state of index function π after each of the remaining applications of the Least element algorithm needed to complete the Selection sort of (K, N, I, G, H, T, E, D). (f) What is the total number of comparisons used during this sort? (g) By contrast, how many comparisons, in total, would be used to sort (K, N, I, G, H, T, E, D) using the Merge sort algorithm? To find out, carry out the Merge sort algorithm on (K, N, I, G, H, T, E, D) and carefully count the comparisons, remembering that when the Merge algorithm reaches a stage where one of its input lists is empty, it does not need any more comparisons to complete its task.