Version française
Home     About     Download     Resources     Contact us    
Browse thread
Keeping a sorted list vs sorting at the end?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Keeping a sorted list vs sorting at the end?
On Sat, Aug 19, 2006 at 08:57:02PM -0700, jean-david hsu wrote:
> Just wondering on the average if it is more efficient to take time to 
> keep a list sorted as we insert or simply sort the list at the end?
> 
[...]

Sort list at the end.
If you want to sort at insertion time, then
trees are the better technique.

In OCaml there are the Set and the Map module, which
may be useful to you.

It depends on what you want to do, what kind of datastructure/module
is best suited.


Ciao,
   Oliver