Check quick sort on Wikipedia to understand how it works.sub qsort { return @_ if @_ < 2; my $pivot = pop; qsort(grep $_ < $pivot, @_), $pivot, qsort(grep $_ >= $pivot, @_); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do i sort an numeric array without using sort function. Is ther any way to sort it just with loop in perl??
by Tabish (Acolyte) on Nov 03, 2017 at 09:20 UTC |