Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Dalila.Bakir@univ-valenciennes.fr (Dalila Bakir - Limav)
Cc: caml-list@inria.fr
Subject: Re: Ocaml: module Map
Date: Thu, 9 Oct 1997 10:33:28 +0200 (MET DST)	[thread overview]
Message-ID: <199710090833.KAA17017@pauillac.inria.fr> (raw)
In-Reply-To: <3433BC8B.5F93@univ-valenciennes.fr> from Dalila Bakir - Limav at "Oct 2, 97 03:23:55 pm"

> Du point de vue de la complexite, les acce's et les modifications sur
> les "Maps" sont d'ordre log(n) si n est la taille d'une "Map". Quelle
> serait la complexite de l'ope'ration "fold"?.

Map.fold parcours les n elements du dictionnaire, sa complexite est
donc au moins O(n).  En fait, c'est exactement O(n) puisqu'il s'agit
d'un parcours gauche-droite d'arbre binaire.

> Plus pre'cise'ment, si
> j'utilise "fold" pour rechercher la valeur maximale de la cle', la
> comple'xite' serait-elle la me^me?

Si vous utilisez Map.fold, c'est forcement en O(n).

L'implementation sous-jacente des dictionnaires (arbres binaires
croissants equilibres) permettrait de determiner le max de la cle en
temps log(n), mais ce n'est pas une des operations exportees par le
module Map.

- Xavier Leroy





      reply	other threads:[~1997-10-09 19:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-02 15:23 Dalila Bakir - Limav
1997-10-09  8:33 ` Xavier Leroy [this message]

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=199710090833.KAA17017@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=Dalila.Bakir@univ-valenciennes.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