On Tuesday 07 November 2006 09:17, Micha Nelissen wrote: > Chris Cheney wrote: > > > Of course, the efficient way to build a sorted list is to set > > Sorted to False and to sort the list after all the items have been > > added. > > It doesn't matter in O-time: both are O(n log n). Nevertheless, you > probably will save some function call overhead.
That highly depends on the sorting algorithm used. A plain Quicksort has a very bad worst case of O(n**2) that develops especially when the list to be sorted already is. Even Bubblesort would be faster in such a case. Vinzent. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel