POV-Ray : Newsgroups : povray.off-topic : Ratatouille : Re: Ratatouille Server Time
11 Oct 2024 03:18:08 EDT (-0400)
  Re: Ratatouille  
From: Warp
Date: 27 Mar 2008 11:16:30
Message: <47ebc85e@news.povray.org>
Orchid XP v7 <voi### [at] devnull> wrote:
> Anyway, assuming you've already got a heapsort function that takes a 
> list and completely sorts it, and you want to swap from quicksort to 
> heapsort after exactly 16 iterations, you could do something like this:

  While introsort probably doesn't "officially" state how the pivot is
chosen, the median-of-3 choosing algorithm is the de-facto standard.

> Of course, a good quicksort utterly depends on picking the right pivot. 
> And for a linked list, it seems hard to do that without wasting too much 
> time trying to pick a pivot. So I'm not really sure quicksort is a good 
> algorithm to be using on a linked list in the first place, but hey...

  As I have commented to you before, it is possible to use the median-of-3
pivot choice even with linked lists.

  Of course it's much easier to do with a true array, which I think it's
one weak point of Haskell, at least currently?

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.