Write a program that implements radix sort on an array of


Problem

In the early days of data processing (before computers), data was stored on punched cards. A machine to sort these cards contained 12 bins (one for each digit value and + and -). A stack of cards was fed into the machine, and the cards were placed into the appropriate bin, depending on the value of the selected column. By restacking the cards so that all zeros were first, followed by the ones, followed by the twos, and so forth, and then sorting on the next column, the whole deck of cards could be sorted. This process, known as radix sort, requires c n passes, where c is the number of columns and n is the number of cards. We can simulate the action of this machine using an array of queues. During the first pass, the least significant digit (the ones digit) of each number is examined and the number is added to the queue whose subscript matches that digit. After all numbers have been processed, the elements of each queue are added to an eleventh queue, starting with queue[0], followed by queue[1], and so forth. The process is then repeated for the next significant digit, taking the numbers out of the eleventh queue. After all the digits have been processed, the eleventh queue will contain the numbers in sorted order. Write a program that implements radix sort on an array of int values. You will need to make 10 passes, because an int can store numbers up to 2,147,483,648.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that implements radix sort on an array of
Reference No:- TGS02654134

Expected delivery within 24 Hours