Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1.2 Radix sort Left-to-Right Radix sort does not sort strings by comparing them. It looks at the first char acter in each string and divides
1.2 Radix sort Left-to-Right Radix sort does not sort strings by comparing them. It looks at the first char acter in each string and divides the strings into groups (called piles) based on this character So all the strings beginning with "a" go into the same pile. In other words, it uses the first character as the index for where to store the string in an array of piles. It then recursively sorts the strings in each pile, which all have the same first character, starting with the second character. The integer j in the code below indicates which character to start at: the first call is L2RRadixSort( S, o). We assume that the strings are composed of the characters from the alphabet (a,b,c,d,e.) L2RRadixSort( vector & s, int j ) I. If S. size() T 5. For every character c in alphabetic order L2RRadixSort( Pile [c], j+1 ) 7. Append Pile[c] to T 8. S-T (a) (4 points) Show us that you understand the algorithm by executing two levels of recursion on the given set of 8 strings, placing the piles of strings in the appropriate array cells. Please identify the strings using only their index numbers from the table above. At the end of each call to the function do not reassemble the data into a vector-we just want to see the piles! After you have finished the two levels, circle all of the piles that will require further classification b) (4 points) In the original table of strings, mark the cells that are examined by a complete execution of Left-to-Right Radix sort. We have marked (shaded) the cells corresponding to the examination of the first character for you. (c) (1 point) If we measure the size of the data by the total number of characters in the data set, what fraction of this data set was explored in the complete execution of the algorithm? Ipuore the tnaling mills.) (d) (4 points) Finally, fill in the table below with a set of 8 unique strings on which Left-to- Right Radix sort examines all the characters. Assume abc
Step 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