Sorting algorithms/Quicksort: Difference between revisions

m
Line 446:
 
qsort() {
lc="1.$1" ; gc="2.$1"
read pivot; while read n ; do
gc="2.$1"
test $pivot -gt $n && echo $n >> $lc || echo $n >> $gc
(
read pivot;done
test test-n "$pivot" != "" && ( (cat -s $lc | qsort $lc ); echo $pivot; (cat -s $gc | qsort $gc ))
while read n
do
test $pivot -gt $n && echo $n >> $lc || echo $n >> $gc
done
test "$pivot" != "" && ( (cat -s $lc | qsort $lc ); echo $pivot; (cat -s $gc | qsort $gc ))
)
rm -f $lc $gc;
}
418

edits