Re:Why is it faster to process a sorted array than an unsort...
by petters on Friday September 15, 2017 @09:52AM
(#15257125)
Well, the code being measured does one pass through the array. Sorting can in general not be done in linear time, so asymptotically you won't gain anything by sorting first.
Re:Why is it faster to process a sorted array than an unsort...
by Iburinoc on Friday September 15, 2017 @09:59AM
(#15257182)
Well sure, but from an asymptotic approach both unsorted and sorted are "linear", so asymptotics don't necessarily provide enough information to answer GP's question.
Edit: Whoops, I misunderstood. Sorry!