Re: Randomisation for ensuring nlogn complexity in quicksort

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Randomisation for ensuring nlogn complexity in quicksort
Дата
Msg-id CA+TgmoZdPXWuO-Z+4zfFky=kG-7nOJiP_j6jGdsWzUnDMxMZzA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Randomisation for ensuring nlogn complexity in quicksort  (Claudio Freire <klaussfreire@gmail.com>)
Список pgsql-hackers
On Mon, Jul 1, 2013 at 4:31 PM, Claudio Freire <klaussfreire@gmail.com> wrote:
> What?
>
> A median of medians algorithm will guarantee floor(N/2) elements on
> the smaller. That's the definition of median.
>
> Note that I'm referring to picking the actual median of all tuples,
> not just a sample. That's slow, but it guarantees O(n log n).

Ah, OK.  Well, yes, that would guarantee O(n lg n).  But, as you say,
it would be slow.  :-)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: extensible external toast tuple support
Следующее
От: Robins Tharakan
Дата:
Сообщение: Re: Add more regression tests for CREATE OPERATOR