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!
Printable View
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!
Why don't you look at priority queue.
http://java.sun.com/j2se/1.5.0/docs/...rityQueue.html
http://marknelson.us/1996/01/01/priority-queues/
http://www.java2s.com/Tutorial/Java/...rityQueues.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,
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 dubai real estate