How to determine the continuity of the values of the array and find the gaps?

There are pre-sorted array a of N integer values.
You want to determine whether it is continuous, i.e. A[n+1] = A[n+1] and break this array into subarrays wherever this condition was respected.

There is nothing in your head except for stupid overkill to check the condition A[n+1] = A[n+1] does not come, I wanted to ask is there any faster ways?
June 5th 19 at 21:00
2 answers
June 5th 19 at 21:02
the step values fixed?
this "1" ?

binary search in your hands. you can predict the value of any
as the original array, and fragment. the deviation is possible to conclude that there is a gap (or several)

we must remember that Dvina the sample will be effective in determination of continuous fragments, further breaks may require a modification of the heuristic algorithm

ps for sure!.. in General, all the arguments about arithmetic progressions and binary search is true for any step of the progression (not just 1)
June 5th 19 at 21:04
this is an arithmetic progression. The sum of the elements of the array compare it with the amount of progression, if not equal to run binary search how to write inside, you can also cecati amount

Find more questions by tags AlgorithmsProgramming