Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Wojciech Meyer <wojciech.meyer@googlemail.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Andrew <newsgroups.fr@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] Priority queues, reloaded
Date: Thu, 30 Jun 2011 23:17:07 +0100	[thread overview]
Message-ID: <wfvcvnj76k.fsf@gmail.com> (raw)
In-Reply-To: <BANLkTinAfZGdJ19mRjpoqVTvN9dpCNymFw@mail.gmail.com> (Gabriel Scherer's message of "Thu, 30 Jun 2011 19:26:32 +0200")

Gabriel Scherer <gabriel.scherer@gmail.com> writes:

> The heap implementation in the OCaml manual, which was pointed to in
> the precedent thread, is quite compact.
>
> Okasaki (eg. in its book "Purely functional data structure", but can
> probably be found in papers available on the net) has a "leftist heap"
> data structure that is also compact and, to my personal taste, easier
> to understand, get familiar with and remember than the usual heap
> implementation -- or more exotic heaps. I was once in a situation
> similar to yours and found that I could implement both his leftist
> heap and the red-black trees in around 15 minutes.

Yes, they are nice, and I'd also recommend reading whole book if you
have some time for a good lecture. The examples are in Standard ML so
it's nearly direct translation to OCaml. I think it was mentioned but
Markus Mottl has implemented Okasaki's data structures in OCaml and made
it available on his website.  One thing to note is that you don't need
really laziness in case of leftitst heaps and red-black trees, as far as
I recall both are amortised.

Cheers;
Wojciech

>
> On Thu, Jun 30, 2011 at 7:13 PM, Andrew <newsgroups.fr@gmail.com>
> wrote:
>
>     Hi all,
>     
>     Since the previous discussion regarding priority queues pretty
>     much concluded that they weren't available in OCaml, could you
>     point to the most compact implementation that you know of? I'm
>     very likely to have to recode my own implementation in a
>     time-restricted setting, so I'd love to hear about
>     efficient-yet-easy/fast-to-implement options.
>     
>     Thanks!
>     
>     -- 
>     Caml-list mailing list.  Subscription management and archives:
>     https://sympa-roc.inria.fr/wws/info/caml-list
>     Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>     Bug reports: http://caml.inria.fr/bin/caml-bugs
>     
>     


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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <sfid-j-20110630-131704-+2.76-1@multi.osbf.lua>
2011-06-30 17:13 ` Andrew
2011-06-30 17:26   ` Gabriel Scherer
2011-06-30 18:14     ` Jean-Christophe Filliâtre
2011-06-30 18:36     ` Jean-Christophe Filliâtre
2011-07-09  9:02       ` Jon Harrop
2011-07-09 19:22         ` Jean-Christophe Filliâtre
2011-07-10 18:04           ` Jon Harrop
2011-06-30 19:13     ` Andrew
2011-06-30 22:17     ` Wojciech Meyer [this message]
2011-07-02  1:49   ` Norman Ramsey
2011-07-09  9:05   ` Jon Harrop
     [not found] <848371343.3424870.1309454037170.JavaMail.root@zmbs3.inria.fr>
2011-06-30 18:03 ` Daniel de Rauglaudre
     [not found] <fa.V8myB/rA6OKILQg+GW40f8c1BGo@ifi.uio.no>
2011-07-02 12:24 ` Radu Grigore
2011-07-02 19:05   ` Andrew
2011-07-02 22:42   ` Radu Grigore
2011-07-10 17:55     ` Jon Harrop
2011-07-09 18:45 james woodyatt
     [not found] ` <14B0DF03-EF83-4568-AB34-6B51BCE4B574@recoil.org>
2011-07-09 18:56   ` james woodyatt

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=wfvcvnj76k.fsf@gmail.com \
    --to=wojciech.meyer@googlemail.com \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    --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