Searching for an element in array of adjacent numbers
Given an array of numbers where the difference between any adjacent numbers is 1, how do we efficiently find a given number? For example consider the array {1, 2, 1, 2, 3, 2, 3, 4, 5, 6}, and we want to search for the number 5. The simplest solution is to check if the number…