Hello
What's the fastest way to sort a multidimensional array?
For example, I have an array which consists of the following mixed data:
Account number, First name, Surname, Date of birth
I want to carry out a sort based on the account number.
Using a slightly adjusted version of the the bubble sort method (shown here) I can quickly sort a few hundred rows. When I have tested with 2,000 rows there is a long pause before the iterative part of the sort takes place. Once that begins it takes less than a second.
A similar thing can be seen if the program in the 'Sorting Algorithms Tutorial' is adjusted to have 2,000 items in the list.
Is there a reason for this delay? Is there a better way of sorting multidimensional arrays?
I was hoping to avoid using a database as I didn't think a few thousand rows was that many!
Regards
Joe
What's the fastest way to sort a multidimensional array?
For example, I have an array which consists of the following mixed data:
Account number, First name, Surname, Date of birth
I want to carry out a sort based on the account number.
Using a slightly adjusted version of the the bubble sort method (shown here) I can quickly sort a few hundred rows. When I have tested with 2,000 rows there is a long pause before the iterative part of the sort takes place. Once that begins it takes less than a second.
A similar thing can be seen if the program in the 'Sorting Algorithms Tutorial' is adjusted to have 2,000 items in the list.
Is there a reason for this delay? Is there a better way of sorting multidimensional arrays?
I was hoping to avoid using a database as I didn't think a few thousand rows was that many!
Regards
Joe