I was going to suggest Bernd's idea of sorting references. This means the constant for the O(n log n) part is lower but it adds an O(n) step at the end with a higher constant. It should be faster for large n.
Using the stack doesn't make sense since the stack is allocated out of the dynamic heap. If you have enough dynamic heap space, you might as well use it directly rather than via the stack. -- Danny @ Palm -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
