Problem statement: Given an bitonic array, find the max element in that. Example: Array {1, 2, 3, 4, 5, 4, 3, 2, 1}; Output = 5 A bitonic array is an ascending sorted array where, after a particular element, the array starts descending. In our example …

Problem Statement: You are given an unsorted array and you need to send the index of peak element. Understanding what is Peak element? 1. An element who is greater than both of its neighbor. Example array = {1, 2, 5, 4, 3}. Here peak element is …

Problem statement: YOu are given a sorted array of infinite length of 0’s and 1’s. You need to find the first occurrence of 1. Example: array = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} Output: 1 …

Question: You are given an array in sorted order, but it is infinite. You are also given an key element. You need to check if the element is present in that infinite array. array = {1, 2, 3, 4, 5, 7, 8, 9, 10, 100, 200, …

Question: You are given an array and a key. You need to return the Ceil of that element. What is Ceil? If you are given a number say “5.8”, the floor of that number is 5 and ceil is 6. What will be the Ceil in …

Question: You are given an array and a key. You need to return the floor of that element. What is floor? If you are given a number say “5.8”, the floor of that number is 5 and ceil is 6. What will be the floor in …

Problem Statement: Given a sorted array where an element that should be present in i’th position, can be present in i-1’th position or i+1’th position. You are also given a key element. Check if the key element is present or not. Example: array = {1, 2, …

Question: You are given an array that is rotated clockwise, you need to find the number of times the array is rotated. Example 1: array = {5, 6, 1, 2, 3, 4} Output = 2 Times. Why? Because, the sorted array will be {1, 2, 3, …

Question: Given an array sorted in ascending order with repeated elements and given the key. Find the first and last occurrence of that key. Example: array = {2, 3, 4, 4, 4, 5, 6, 7, 8}; key = 4. Here “4” is repeated 3 times. We …

Question: Given an array whose order of sorting is unknown and a key. You need to check if the key is present or not using binary search. Solution: As the question stated, we dont know the order of the array. Our first step is to get …