in reply to Inertion sort in perl
Perl uses a variant of QuickSort and for almost all of your sorting, you should too! This is normally faster than SelectSort. Use the power of the language!
Re-coding your program,
@a = (8,5,2,4,88,1,5,4,3,2); @a = sort @a; #same as @a = sort{$a <=> $b}@a; #because only digits not alpha/digits print "@a","\n"; #prints: 1 2 2 3 4 4 5 5 8 88
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inertion sort in perl
by Corion (Patriarch) on Apr 25, 2009 at 15:54 UTC | |
by Marshall (Canon) on Apr 25, 2009 at 17:15 UTC |