Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
Line 449: Line 449:
done)
done)
}
}

qsort() {
qsort() {
read p; test -n "$p" && (
(read p; test -n "$p" && (
lc="1.$1"; gc="2.$1"
lc="1.$1" ; gc="2.$1"
split $p >(>>$lc) >(>>$gc);
split $p >(qsort $lc >$lc) >(qsort $gc >$gc);
cat -s <(cat -s $lc|qsort $lc) <(echo $p) <(cat -s $gc|qsort $gc)
cat $lc <(echo $p) $gc
rm -f $lc $gc;
rm -f $lc $gc;
)
))
}
}