Quicksort

Hide text Hide pseudo-code

Use quicksort to sort the table below. The parameters are on top of the call stack, denote the boundaries of the currently active area. The parameters of the initial quicksort function call have been placed in the stack as a starting point.

quicksort(array:Array, 
          left:integer, right:integer)

  if |left-right| < 3
    sort by any method
  else
    split = partition(array,left,right)

    if (split-1)-left > 0
      quicksort(array, left, split-1)
    if right-(split+1) > 0
      quicksort(array, split+1, right)

  endif
end


  Created Fri Oct 30 13:52:50 EET 2009 - Powered by SVG-hut