Stack Overflow
6/27/2012
Why is processing a sorted array faster than processing an unsorted array?
Here is a piece of C++ code that shows some very peculiar behavior. For some strange reason, sorting the data miraculously makes the code almost six times faster: