Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: regarding queues

  1. #1
    Member
    Join Date
    May 2011
    Posts
    61
    My Mood
    Busy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default regarding queues

    Hi, if I want to build a minimum priority queue and inserting by keys (not the letters) would it be w/ example of key-value pairs:
    so inserting: (a->3), (b->10), (c->3), (d->1), (z->110)

    (d->1), (a->3), (c->3), (b->10), (z->110)

    OR IS IT:

    (d->1), (c->3), (a->3), (b->10), (z->110)

    so I'm confused when the new entry has the same key as a current entry, if it's the same, I think it makes more sense to put it after all entries that have same keys b/c it's a queue, but also minimum priority, so if it's not smaller, follow the rules of a queue, is that correct, so the the former final list is the proper miniimum priority queue? I just want to make sure.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: regarding queues

    This would be a design decision made during writing the requirements. Who wrote the requirements? Certainly not me.
    Improving the world one idiot at a time!

  3. #3
    Member
    Join Date
    May 2011
    Posts
    61
    My Mood
    Busy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: regarding queues

    Thanks for replying, I thought a min-PQ always meant priority, but what you say makes sense. I ask because I google online but the sources all show using all unique values, and no dupilcates, that's why I was a little confused. But in terms of building a Huffman tree, I need to arrange the characters from least to most frequency, so which way should I choose to be most efficient...or does it have same cost

Similar Threads

  1. Having problems with Queues, any help ad I would be great full!
    By sim18 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 25th, 2012, 04:09 PM
  2. [SOLVED] Please Help (Queues)
    By husain2213 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: September 30th, 2012, 12:01 AM
  3. Help with queues
    By araujo3rd in forum Collections and Generics
    Replies: 2
    Last Post: March 10th, 2010, 11:20 AM
  4. Multiple Queues
    By fh84 in forum Threads
    Replies: 1
    Last Post: December 3rd, 2009, 02:28 PM