read from the source ( file or the internetand they are placed in queue called the mainqueue as the strings are read and placed in the queue the algorithm keeps track of the length of the longest string that will be sorted we'll call this length longest for the radix sort algorithm to work correctlyall the strings in the mainqueue need to be the same lengthwhich is not likely of course if string is shorter than the longest string it can be padded with blanks to assistit is handy to have function that returns character of string like the charat function in sect the charat function def charat( , )if len( ireturn return [ithe charat function returns the ith character of the string and blank if is greater than or equal to the length of with the use of this function the strings in the mainqueue can be different lengths and the charat function will make them look like they are the same length in addition to the mainqueuethere are queues created and placed into list of queuescalled queuelist there are different possible ascii values and one queue is created for each ascii letter since most ascii characters are in the range of - the algorithm probably won' use the queues at indices - the sorting algorithm works by removing string from mainqueue it looks at the last characterstarting at longest- in each string and placing the string on queue that corresponds to the character' ascii value soall strings ending with 'ago on the 'aqueue and so on to find the index into queuelist the ord function is used for instancewriting ord(" "would return which is the index to use into the queuelist for the character "athenstarting with the first queue in the queuelistall strings are dequeued from each queue and placed on the main queue we empty each queue first before proceeding to the next queue in the queuelist this is repeated until all letter queues are empty thenwe go back to removing all elements from the main queue againthis time looking at the second to the last letter of each word each string is placed on queue in the queuelist depending on its second to last letter the process is repeated until we get to the first letter of each string when we are doneall strings are on the main queue in sorted order to complete the algorithm all strings are removed from the mainqueue one more time in sorted order radix sort example to see how radix sort works we'll consider an example where the words batfarmbarncarhatand cat are sorted alphabetically in the figures in this section each this copy belongs to 'acha