
January 11th, 2008, 07:14 PM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 1
Time spent in forums: 28 m 26 sec
Reputation Power: 0
|
|
Help with queues and Radixsort
Dear all:
I have been working on a program to do a radix sort to sort numbers.
Basically what I am doing is reading numbers from a file, then putting them into a master queue. Then I go through the entire master queue and dequeue each number into a corresponding subqueue based on the thousands digit. I do it based on mod 10. I enqueue the number into a subqueue1...subqueue9
If the thousands digit was 8 for example the number would go into subqueue8. I then enqueue each subqueue back into the master queue from subqueue0 to subqueue9. Finally, after 2 more runs I do the 100's digit and the 10's digit until it is finally sorted.
My question is, I do not know how to dequeue a number from one queue and then simultaneously enqueue the number into another queue. I would greatly appreciate help. If you could give code, that would be great. Thanks
|