Why is it faster to process a sorted array than an unsorted array?