caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Seth Fogarty <sfogarty@gmail.com>
Cc: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] Re: Set and Map question
Date: 20 Sep 2004 13:56:10 +1000	[thread overview]
Message-ID: <1095652570.2580.298.camel@pelican.wigram> (raw)
In-Reply-To: <c7ee6112040919201417b7328@mail.gmail.com>

On Mon, 2004-09-20 at 13:14, Seth Fogarty wrote:

> What I MEANT to ask is: Is there a O(n) method of set/map construction
> from a list, as opposed to the O(n log n) fold method.

It seems to me that in general that is impossible,
since random tree insertions are at least O(log n)
in the tree size (proportional to depth).

Perhaps you meant, assuming the list is sorted?
In that case, in theory you could precalculate
the shape of the tree just from the size, and then
fill in the elements in O(n).

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-09-20  3:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20  2:37 [Caml-list] " Seth Fogarty
2004-09-20  3:14 ` [Caml-list] " Seth Fogarty
2004-09-20  3:56   ` skaller [this message]
2004-09-20  4:18     ` Seth Fogarty
2004-09-20  6:43       ` skaller
2004-09-20  8:32       ` Diego Olivier Fernandez Pons
2004-09-20  4:02   ` Brian Hurt
2004-09-20  8:17     ` Richard Jones
2004-09-20 12:41       ` Igor Pechtchanski
2004-09-20 12:54         ` Jean-Christophe Filliatre

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=1095652570.2580.298.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@pauillac.inria.fr \
    --cc=sfogarty@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).