Hello,
This is not an actual priority queue though: it doesn't allow
for multiple copies of the same element to be added :/
Yes but you could simulate it with a list and map.
Or a set of tuple (p, id) where p is the priority and id the process
number (= arrival time).
Then you sort lexicographicaly first by increasing priority and
second decreasing id to have FIFO for equal priority.
And I think a less than 10 lines O(N ln(N)) re-implemantation or
priority queues would
give you good result at your competitive exam !
My two cents,
Christophe
Cheers;
Wojciech
--
Christophe Raffalli
Universite de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex
tel: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------