advanced sorting are once again gathered back into the arrayone bin at time as shown in step (dthe result is correct ordering of the keys from smallest to largestas shown at the bottom of figure in this examplethe largest value ( only contains two digits thuswe had to distribute and then gather the keys twiceonce for the ones column and once for the tens column if the largest value in the list had contain additional digitsthe process would have to be repeated for each digit in that value basic implementation the radix sortas indicated earlieris not general purpose algorithm insteadit' used in special cases such as sorting records by zip codesocial security numberor product codes the sort keys can be represented as integersrealsor strings different implementations are requiredhoweversince the individual key components (digits or charactersdiffer based on the type of key in additionwe must know the maximum number of digits or characters used by the largest key in order to know the number of iterations required to distribute the keys among the bins in this sectionwe implement version of the radix sort algorithm for use with positive integer values stored in mutable sequence firstwe must decide how to represent the bins used in distributing the values consider the following points related to the workings of the algorithmthe individual bins store groups of keys based on the individual digits keys with duplicate digits (in given columnare stored in the same binbut following any that are already there when the keys are gathered from the binsthey have to be stored back into the original sequence this is done by removing them from the bins in first-in first-out ordering you may notice the bins sound very much like queues and in fact they can be represented as such adding key to bin is equivalent to enqueuing the key while removing the keys from the bins to put them back into the sequence is easily handled with the dequeue operation since there are ten digitswe will need ten queues the queues can be stored in ten-element array to provide easy management in the distribution and gathering of the keys our implementation of the radix sort algorithm is provided in listing the function takes two argumentsthe list of integer values to be sorted and the maximum number of digits possible in the largest key value instead of relying on the user to supply the number of digitswe could easily have searched for the largest key value in the sequence and then computed the number of digits in that value the implementation of the radix sort uses two loops nested inside an outer loop the outer for loop iterates over the columns of digits with the number of iterations based on the user-supplied numdigits argument the first nested loop in lines - distributes the keys across the bins since the queues are stored in