IT Community - Software Programming, Web Development and Technical Support

What is the minimum number of queues needed to implement the priority queue?

This is a discussion on What is the minimum number of queues needed to implement the priority queue? within the C and C++ Programming forums, part of the Software Development category; Two. One queue is used for the actual storing of data, and the other one is used for storing the ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-21-2007, 01:21 AM
sundarraja sundarraja is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 174
sundarraja is on a distinguished road
Post What is the minimum number of queues needed to implement the priority queue?

Two. One queue is used for the actual storing of data, and the other one is used for storing the priorities.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-31-2007, 02:34 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Arrow Re: What is the minimum number of queues needed to implement the priority queue?

A priority queue is a data structure for maintaining a collection of items each with an associated key (or priority). A priority queue supports the following operations:

* insert - add an item and its key to the priority queue
* maximum (or minimum) - return the item of highest priority
* extractMax (or extractMin) - remove the item of highest priority and return it

as well as the now standard isEmpty, isFull, and size operations.

If each item's priority is taken to be time at which it is inserted, then we get a first-in-first-out structure (i.e. a queue), thus the name priority queue.

What happens if two different items have the same priority? There are several options. As stated so far, there is no rule - so which ever item is extracted first is arbitrary. Alternatively, we can, as Main & Savitch do, treat the item that arrives first as if it had higher priority. In any case, this should be documented in specification of the priority queue.

The minimum number of queues is one
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Minimum time to make live a Website in Internet kiret23 Search Engine Optimization 9 02-21-2008 08:52 AM
difference between bug priority & bug severity srikumar_l Software Testing 0 12-06-2007 01:11 AM
Severity and Priority simplesabita Software Testing 2 08-29-2007 10:10 AM
How would you implement a queue from a stack? sundarraja C and C++ Programming 1 07-31-2007 03:49 AM
Can any one explain why project needed XML? oxygen XML and SOAP 1 07-26-2007 04:27 AM


All times are GMT -7. The time now is 08:50 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0