Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] sorting Hashtbl.t
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yann_Régis-Gianas <yann@l...>
Subject: Re: [Caml-list] sorting Hashtbl.t
On Sun, Aug 11, 2002 at 09:08:24PM -0400, Oleg wrote:
> 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 Archives:
Bug reports: FAQ:
Beginner's list: