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 LAA27480; Mon, 12 Aug 2002 11:54:26 +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 LAA27476 for ; Mon, 12 Aug 2002 11:54:25 +0200 (MET DST) Received: from colt.epita.fr (colt.epita.fr [62.23.180.27]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g7C9sNf15434 for ; Mon, 12 Aug 2002 11:54:23 +0200 (MET DST) Received: from hermes.epita.fr (hermes.epita.fr [163.5.255.10]) by colt.epita.fr id g7C9vtE14991 for EPITA Paris France Mon, 12 Aug 2002 11:57:55 +0200 (MEST) Received: from goa.lrde.epita.fr (mail@goa.lrde.epita.fr [10.223.13.2]) by hermes.epita.fr id g7C9vug24673 for EPITA Paris France Mon, 12 Aug 2002 11:57:56 +0200 (MEST) Received: from barcelona.lrde.epita.fr ([10.223.13.32] ident=mail) by goa.lrde.epita.fr with esmtp (Exim 3.35 #1 (Debian)) id 17eBxV-0001Bp-00 for ; Mon, 12 Aug 2002 11:57:57 +0200 Received: from yann by barcelona.lrde.epita.fr with local (Exim 3.33 #1 (Debian)) id 17eC9X-00028E-00 for ; Mon, 12 Aug 2002 12:10:23 +0200 Date: Mon, 12 Aug 2002 12:10:21 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] sorting Hashtbl.t Message-ID: <20020812101020.GV6002@barcelona.lrde.epita.fr> Reply-To: yann@lrde.epita.fr References: <200208120108.VAA16373@dewberry.cc.columbia.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200208120108.VAA16373@dewberry.cc.columbia.edu> User-Agent: Mutt/1.3.25i From: =?iso-8859-1?Q?Yann_R=E9gis-Gianas?= Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, Aug 11, 2002 at 09:08:24PM -0400, Oleg wrote: > Hi Hi, > Is there any way to sort Hashtlb.t or otherwise make Hashtbl.iter iterate > elements in order [1]? > From an algorithmic point of view, there is no way to sort an hash table since there is no order attached to items. Indeed, the association is done through hash function that gives a fast-computable signature to each key to find them quickly. (Re-)read the Cormen's book to understand why you can't ask for such a feature ... Maybe you want Map.t that is an ordered associative structure ? -- Yann Régis-Gianas. ------------------- 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