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 LAA27435; Mon, 12 Aug 2002 11:52:37 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA27431 for ; Mon, 12 Aug 2002 11:52:36 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g7C9ptX15281 for ; Mon, 12 Aug 2002 11:52:27 +0200 (MET DST) Received: from mel-rta8.wanadoo.fr (193.252.19.79) by mel-rto3.wanadoo.fr (6.5.007) id 3D49FC7D003F0373; Mon, 12 Aug 2002 11:51:54 +0200 Received: from warp (80.13.116.58) by mel-rta8.wanadoo.fr (6.5.007) id 3D49FF790039990E; Mon, 12 Aug 2002 11:51:54 +0200 Message-ID: <001501c241e5$df9c64c0$0700a8c0@warp> From: "Nicolas Cannasse" To: "Oleg" , References: <200208120108.VAA16373@dewberry.cc.columbia.edu> Subject: Re: [Caml-list] sorting Hashtbl.t Date: Mon, 12 Aug 2002 11:51:46 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > [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. If you want such a behavior, you should use a Binary Search Tree instead. Nicolas Cannasse ------------------- 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