View Single Post
Old 08-25-2009, 02:10 PM   #2 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

This is really what databases are for, why do you have unsorted arrays this large?

If it must stay in an array, this algorithm is what I can give you off the top of my head (there are probably much more efficient ways of doing this):
Objective: To sort rows by points then for then goal:
1. Bubble sort by name
2. Split the array by name
3. Sort by for in each group
4. Split each of those arrays by for.
5. Sort by goals in each group.
6. Merge them back together.

Memory won't be an issue with only a few rows, but don't do this with hundreds of rows. This has potential to be a memory monster.
__________________

Village Idiot is offline  
Reply With Quote