Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Discrete Math Question 5 The letters of the word TROUNCED form the list (X.)1.8-(T,RO,U,N,C,E,D) This list is to be sorted into alphabetical order using Selection
Discrete Math
Question 5 The letters of the word TROUNCED form the list (X.)1.8-(T,RO,U,N,C,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 T, rather than by shuffling members of the list itself. So initially (xX)a 2 3 4 5 6 7 8) and when sorting is complete ? is sufficiently changed so that (X,(i))1.8 is in order 2345 6 718 9 m233 (a) First apply the Least Element algorithm to (X)18. Demonstrate the application byE) 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 t race table (d) Write out the newly inodified 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 (T,R,O,U,N,C,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 (T,R,O,U,N,C,E,D) using the Merge sort algorithm? To find out, carry out the Merge sort algorithm on (T,R,O,U,N,C,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. Question 5 The letters of the word TROUNCED form the list (X.)1.8-(T,RO,U,N,C,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 T, rather than by shuffling members of the list itself. So initially (xX)a 2 3 4 5 6 7 8) and when sorting is complete ? is sufficiently changed so that (X,(i))1.8 is in order 2345 6 718 9 m233 (a) First apply the Least Element algorithm to (X)18. Demonstrate the application byE) 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 t race table (d) Write out the newly inodified 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 (T,R,O,U,N,C,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 (T,R,O,U,N,C,E,D) using the Merge sort algorithm? To find out, carry out the Merge sort algorithm on (T,R,O,U,N,C,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 taskStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started