Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 11th, 2008, 07:14 PM
aggie5478 aggie5478 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 1 aggie5478 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 26 sec
Reputation Power: 0
Exclamation 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

Reply With Quote
  #2  
Old January 23rd, 2008, 07:17 PM
paulscode's Avatar
paulscode paulscode is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: Fort Meade, MD
Posts: 51 paulscode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 59 m 20 sec
Reputation Power: 1
From one queue to another.

Why can't you do something like this:
Code:
Queue<Double> subqueue1;
Queue<Double> subqueue2;

// ... some stuff goes into the queues ...

Double myDouble = subqueue1.element();
subqueue2.add(myDouble);

I probably am not getting your problem. I'll be happy to help you if you are haven't figured this problem out yet.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Help with queues and Radixsort


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT