caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Priority queues
Date: Thu, 30 Jun 2011 19:29:44 +0200	[thread overview]
Message-ID: <4E0CB288.1080302@univ-savoie.fr> (raw)
In-Reply-To: <BANLkTimQ=VVdzP=ZvddHRaZiSeoz388SYQ@mail.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1304 bytes --]

Hello,
>
>
>     > Yes it does:
>     >
>     > http://caml.inria.fr/pub/docs/manual-ocaml/libref/Set.Make.html
>     >
>     > Please see min_elt function.
>     >
>
>     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
---------------------------------------------


[-- Attachment #1.1.2: Type: text/html, Size: 2776 bytes --]

[-- Attachment #1.2: Christophe_Raffalli.vcf --]
[-- Type: text/x-vcard, Size: 310 bytes --]

begin:vcard
fn:Christophe Raffalli
n:Raffalli;Christophe
org:LAMA (UMR 5127)
email;internet:christophe.raffalli@univ-savoie.fr
title;quoted-printable:Ma=C3=AEtre de conf=C3=A9rences
tel;work:+33 4 79 75 81 03
note:http://www.lama.univ-savoie.fr/~raffalli
x-mozilla-html:TRUE
version:2.1
end:vcard


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2011-06-30 17:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30 11:30 Andrew
2011-06-30 11:40 ` Török Edwin
2011-06-30 11:56   ` Andrew
2011-06-30 12:13     ` Wojciech Meyer
2011-06-30 12:34       ` Andrew
2011-06-30 12:43         ` Wojciech Meyer
2011-06-30 17:29           ` Christophe Raffalli [this message]
2011-06-30 17:45             ` Christophe Raffalli
2011-06-30 12:28     ` Guillaume Yziquel
2011-06-30 12:33 ` Jean-Christophe Filliâtre
2011-06-30 13:19   ` Michael Ekstrand
2011-06-30 14:07     ` Alexandre Pilkiewicz
2011-06-30 14:20       ` Michael Ekstrand
2011-06-30 14:22       ` David Rajchenbach-Teller
2011-06-30 14:29         ` Wojciech Meyer
2011-06-30 17:11           ` Andrew
2011-06-30 22:51             ` Wojciech Meyer
2011-07-01  5:06               ` Andrew
2011-06-30 16:06         ` Jean-Christophe Filliâtre
2011-07-01 10:32           ` Andrew
2011-07-01 10:51             ` Frédéric van der Plancke
     [not found] <fa.zXwbS6BNVmuh5Yg3lR+NAiHb7b8@ifi.uio.no>
2011-07-01 22:37 ` Radu Grigore
2011-07-02 20:54   ` Brian Hurt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E0CB288.1080302@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).