Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort function

Status
Not open for further replies.

johno77

Technical User
Nov 1, 2003
40
0
0
GB

Hello

Has anybody ever built there own sort function before without using the in built sort command. If anyone has would it be possible to get a look at te code for it.

many thanks

john
 
While you can, it's not really worthwhile. You can search the net for the various sorting algorithms if you're interrested in the theory. In Perl, when you need to do a complicated sort, you can create custom sort subs or generate packed sort fields, which is incredibly powerful, without bothering with the run-of-the-mill sorting algorithms. You get to more actual work rather than spending time on proven theory. Perl's sort function uses a merge sort, so there's little reason to not use it. On top of everything else, sort's merge sort is defined in C, so it executes much faster than anything you could create in Perl alone.

For a good read on sorting, I suggest this paper.

________________________________________
Andrew - Perl Monkey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top