in reply to Quicksort problem
I recommend that you use Perl sort() rather than trying to implement a my_sort() routine yourself.
Update: I skipped Perl 5.8 and went straight from 5.6 to 5.10. I know that the worst case quicksort issue (already ordered) went away. But more happened than just that. The sorting got significantly faster. Probably a combination of algorithm and implementation changes? I have not investigated all of the details. I just know that it is a lot faster. The sort time got so much better that it has caused me to re-think many places where I used techniques like Schwartzian transform.
As a learning exercise, I think one should be familiar with all the basic sorting algorithms. There is a lot to be learned from that and there is a reason why this is taught in every CS curriculum. I guess I just wound up with a very long winded way of saying: the Perl sort() function is no slouch!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quicksort problem
by MidLifeXis (Monsignor) on Nov 22, 2011 at 11:30 UTC | |
|
Re^2: Quicksort problem
by JediMasterT (Sexton) on Nov 23, 2011 at 02:32 UTC |