Finding element in rotated arrays in O(log n) time