caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Wojciech Meyer <wojciech.meyer@googlemail.com>
To: Andrew <newsgroups.fr@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Priority queues
Date: Thu, 30 Jun 2011 23:51:18 +0100	[thread overview]
Message-ID: <wfboxfj5ll.fsf@gmail.com> (raw)
In-Reply-To: <4E0CAE39.9000002@gmail.com> (Andrew's message of "Thu, 30 Jun 2011 19:11:21 +0200")

Andrew <newsgroups.fr@gmail.com> writes:

> Wojciech Meyer wrote:
>> And if one does not need performance but understanding what's the purpose of the priority queue is,
>> what is the interface, and how it should behave, than implementation as a list is sufficient. Please note
>> it is for exam and major pressure is put on Dijkstra not on implementation or performance (as far as I
>> understood) of the priority queue. (which can be changed later easily)
>
> Not really. This is a practical exam. 3h and a half facing a computer,
> with a set of problems to solve, with huge inputs. Hence the need for
> performance.
>
> Here, Dijkstra's algorithm is only going to be a step in the process
> of solving a more elaborate problem. Not having a priority queue
> readily available means that I am going to have to waste some time
> reimplementing an efficient structure.

Yes, then you'd need a real priority queue.

I would suggest using Batteries (some people might disagree and saying
it's an overkill in this case). It all depends on the rules, if you can
use any of code taken from home, or any external libraries for instance,
or you would need to have them written down only on a piece of paper, or
bringing some reference like book is feasible, etc. If it's all about
high level problem solving, then they are ready algorithms for Dijkstra
as well (e.g. excellent graph library: OCamlGraph).

>
> The Set option covers some cases (and it does work in the case of Dijkstra) ; but in other cases it won't work :/

Yet it will work for Dijkstra, alternatively you could take some code
out of standard OCaml library (Set, Map) and change it to your needs.
(but I think that Redblack trees are easy enough to implement).

Regarding your choice, I don't think you will regret OCaml even if it
does not have the priority queue as a part of the standard library :)
Like in the previous post, I also think it has some very nice features
and also some ugly design features of C++ are not present in OCaml. I
use to do a lot of C++ in past, and just feel much better now. (and
features like fast GC, performance, pattern matching and many others
just make programming so pleasant) It's worth investing time in O'Caml
and certainly it's a perfect choice for this type of exam, (and really
for any type of programming, I think).

Mine two cents,

Thanks,
Wojciech


  reply	other threads:[~2011-06-30 22:51 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
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 [this message]
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=wfboxfj5ll.fsf@gmail.com \
    --to=wojciech.meyer@googlemail.com \
    --cc=caml-list@inria.fr \
    --cc=newsgroups.fr@gmail.com \
    /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).