Click to See Complete Forum and Search --> : Queue


AJ Jonior
October 3rd, 2008, 12:12 PM
i want to do a program using 2 queues to sort a number of integers but i am not sure where and how to start.i have basic java skills! Help Please!

ahoodin
October 3rd, 2008, 12:31 PM
Why don't you look at priority queue.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/PriorityQueue.html
http://marknelson.us/1996/01/01/priority-queues/
http://www.java2s.com/Tutorial/Java/0140__Collections/PriorityQueues.htm
A priority queue will sort queue entries. It is implemented as a heap.

#1 Reheapification upwards: The addition of a queue item, and sort the queue.

#3 Reheapification downwards: Removal of the highest priority heap item and also sort the queue.

You will also need to understand binary trees. A heap is a special kind of binary tree where the highest priority items are at the top.

HTH,

victor2008
October 6th, 2008, 03:32 AM
A queue is a particular kind of collection in which the entities in the collection are kept in order and the principal operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position. Queues provide services in computer science, transport and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the queue performs the function of a buffer.
_______________________________________
Mens Carhartt Coats (http://www.workwear1.com/browse.cfm/2,79.html) dubai real estate (http://www.choicepropertyinvestment.com/international-developments/dubai-property-investment/)