2 ms·
In the post, he asks this question: "What's the fastest way to find the largest, or smallest, number in an array?" I guess he means fastest code to write, not
by stevoski 16y ago
In the post, he asks this question: "What's the fastest way to find the largest, or smallest, number in an array?"
I guess he means fastest code to write, not the fastest code to run. If you have, say, a million numbers, I'd try doing this using concurrency. If there are two CPUs (or cores), find the maximum in the bottom half of the array and the maximum in the top half in parallel. Then return the maximum of the two maximums.
I don't know much JavaScript - does it have built-in support for concurrency?