Given a bitonic sequence
n distinct elements, write a program to search a given element
k in the bitonic sequence.
- A Bitonic Sequence is a sequence of numbers that is first strictly increasing then after a point strictly decreasing.
- It is guaranteed that there are no duplicates in the input array
- If the element is found then return the index otherwise return
- You are expected to solve this problem in
O(log n)time complexity.
Input: arr = [-2, 5, 10, 20, 15, 4, 1], k = 10 Output: 2 Explanation: Element k Found at index 2
Input: arr = [5, 6, 7, 18, 29, 20, 13, 8, 1], k = 30 Output: -1 Explanation: Element k not found in the array