× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



CRPence wrote:
Adam Glauser wrote:
Personally I prefer Asher's [sort] solution, which is both
more elegant and more efficient. To each their own.

Just curious. Why would a sort be more efficient than spinning the array in the /for loop/ as above? Does the sort not require effectively all the same work?

Erm, I was wrong. I was thinking of quicksort, which is O(n log n). Somehow my memory had turned that into O(log n), which as you pointed out is not possible. I think sort, by definition, can not be better than O(n). The max loop is clearly better.

Your point later about maintaining the order of the original arrays is also well taken.

Thanks for the corrections.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.