Sorting algorithms/Quicksort: Difference between revisions
Content added Content deleted
m (→{{header|Fortran}}: added syntax highlighting) |
m (→{{header|Tailspin}}: Neater expression) |
||
Line 9,509: | Line 9,509: | ||
def last: $(2); |
def last: $(2); |
||
def pivot: $@quicksort($first); |
def pivot: $@quicksort($first); |
||
@: $(1) + 1; |
|||
$(2) -> # |
|||
when |
when <..~$@> do |
||
def limit: $ |
def limit: $; |
||
@quicksort($first): $@quicksort($limit); |
@quicksort($first): $@quicksort($limit); |
||
@quicksort($limit): $pivot; |
@quicksort($limit): $pivot; |
||
Line 9,518: | Line 9,519: | ||
[ $limit + 1, $last ] ! |
[ $limit + 1, $last ] ! |
||
when <?($@quicksort($ |
when <?($@quicksort($) <$pivot~..>)> do |
||
$ - 1 -> # |
|||
when <?($@quicksort($ |
when <?($@quicksort($@) <..$pivot>)> do |
||
@: $@ + 1; $ -> # |
|||
otherwise |
otherwise |
||
def temp: $@quicksort($ |
def temp: $@quicksort($@); |
||
@quicksort($ |
@quicksort($@): $@quicksort($); |
||
@quicksort($ |
@quicksort($): $temp; |
||
@: $@ + 1; $ - 1 -> # |
|||
end partial |
end partial |
||
@: $; |
@: $; |