Group: comp.lang.c++
From: Andy Champ
Date: Monday, April 07, 2008 3:00 PM
Subject: Re: Sort elements in a std::list?

desktop wrote:
> How long does it take to sort elements in a std::list in worst case?
>
> I have read that quicksort on average (depends on partitioning) takes
> O(nlgn). But is quicksort used when sorting a std::list?
>
> And is it possible to sort faster than O(nlgn) in general - not looking
> a best case?

I have to wonder why you put the elements in a list (rather than, say, a
map) if you're going to sort them. Then they could be sorted on-the-fly
as they go in...

Also, you don't *have* to use std::sort.

Andy