POV-Ray : Newsgroups : povray.general : Sort : Re: Sort Server Time
8 Aug 2024 12:19:40 EDT (-0400)
  Re: Sort  
From: Warp
Date: 2 Jan 2001 08:09:28
Message: <3a51d308@news.povray.org>
Lance Birch <-> wrote:
: But bubble sorting is the easiest for a lot of people to understand and
: write :)

  Actually insertion sort is a lot more intuitive than bubble sort.
  If you ask someone who doesn't know anything about sorting to make a
sorting algorithm, he will most probably make an insertion sort (or a very
close variant), not a bubble sort.
  Bubble sort is just awful. It's slow even for an O(n^2) algorithm.
Insertion sort is also an O(n^2) algorithm (that is, very slow), but quite
faster than bubble sort.

  O(n^2) algorithms are hopelessly slow when there are even a slight amount
of items (like 1000 or so). If one wants a good sorting algorithm, it's
necessary to use an O(n*log n) algorithm. Those beat O(n^2) algorithms 10-0
with large amount of items.
  A merge sort might be the easiest to implement in povray.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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