Sorting algorithms/Quicksort: Difference between revisions
→{{header|UnixPipes}}
Line 442:
=={{header|UnixPipes}}==
split() {
(pivot=$1; lc=$2; gc=$3;
while read n ; do
test $pivot -gt $n && echo $n > $lc || echo $n > $gc
done)▼
}
qsort() {
▲ done
)
▲ test -n "$pivot" && ( (cat -s $lc | qsort $lc ); echo $pivot; (cat -s $gc | qsort $gc ))
}
cat to.sort | qsort
|