If it's possible for the array to encompass by subscript, the entire range of the numbers, then this is VERY fast.
for each n, { array[n] += 1 if(array[n] > 1) /* you have found the duplicate n */ break; } I call this "doing a distribution count", but I'm sure there's a better term for it. adak