Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, Implement the radix sort of an array by using a queue for each group. The radix sort is discussed in Section 11.2.3 of

Using C++, Implement the radix sort of an array by using a queue for each group. The radix sort is discussed in Section 11.2.3 of Chapter 11. Here is the radix sort of chapter 11.2.3 image text in transcribedimage text in transcribed image text in transcribed

11.2.3 The Radix Sort The radix sort is included here because it is quite different from the other sorts we've described, as it does not compare the array's entries Imagine again that you are sorting a hand ofcards. This time you pick up the cards one at a time and arrange them by rank into 13 possible groups in this order: 2,3,..., 10, J, Q, K,A. Combine these groups and place the cards face down on the table so that the 2s are on top and the aces are on the bottom. Now pick up the cards one at a time and arrange them by suit into four possible groups in this order: clubs, diamonds, hearts, and spades. When taken together, the groups result in a sorted hand of cards A radix sort uses this idea of forming groups and then combining them to sort a collection of data. The sort treats each data item as a character string. As a first simple example of a radix sort, con- sider this collection of three-letter strings ABC, XYZ, BWZ, AAC, RLT, JBX, RDT, KLT, AEO, TLJ The sort begins by organizing the data according to the rightmost (least significant) letters. Although none of the strings ends in A or B, two strings end in C. Place those two strings into a group. Continu- ing through the alphabet, you form the following groups (ABC, AAC) (TLJ) (AEO) (RLT, RDT, KLT) (JBX) (XYZ, BWZ) Group strings by their rightmost letter The strings in each group end with the same letter, and the groups are ordered by that letter. In addi- tion, the strings within each group retain their relative order from the original list of strings Now combine the groups into one as follows. Take the items in the first group in their present order, follow them with the items in the second group in their present order, and so on. The following group results ABC, AAC, TLJ, AEO, RLT, RDT, KLT, JBX, XYZ, BWZ Combine the groups Next, form new groups as you did before, but this time use the middle letter of each string instead of the last letter

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

4. What advice would you give to Carol Sullivan-Diaz?

Answered: 1 week ago