From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA00136; Mon, 12 Aug 2002 15:44:32 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA00141 for ; Mon, 12 Aug 2002 15:44:31 +0200 (MET DST) Received: from dewberry.cc.columbia.edu (dewberry.cc.columbia.edu [128.59.59.68]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g7CDiTf27824 for ; Mon, 12 Aug 2002 15:44:29 +0200 (MET DST) Received: from there (tw304h3.cpmc.columbia.edu [156.111.84.180]) by dewberry.cc.columbia.edu (8.9.3/8.9.3) with SMTP id JAA29114; Mon, 12 Aug 2002 09:44:22 -0400 (EDT) Message-Id: <200208121344.JAA29114@dewberry.cc.columbia.edu> Content-Type: text/plain; charset="iso-8859-1" From: Oleg To: "Nicolas Cannasse" , Subject: Re: [Caml-list] sorting Hashtbl.t Date: Mon, 12 Aug 2002 09:44:56 -0400 X-Mailer: KMail [version 1.3.2] References: <200208120108.VAA16373@dewberry.cc.columbia.edu> <001501c241e5$df9c64c0$0700a8c0@warp> In-Reply-To: <001501c241e5$df9c64c0$0700a8c0@warp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Monday 12 August 2002 05:51 am, Nicolas Cannasse wrote: > > [1] One could of course copy elements to a list or an array, then sort > > and iterate the latter, but I suppose it is inefficient, as hash table > > elements > > > are "almost sorted". > > In general, Hashtbl are not "almost sorted", as one cannot garantee that > key(x) < key(y) => x < y. I meant sorting by key (or iterating Hashtbl in the order of increasing _keys_). > If you want such a behavior, you should use a Binary Search Tree instead. Regards Oleg ------------------- 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