Median of two sorted arrays of same sizeGiven 2 sorted arrays a[] and b[], each of size n, the task is to find the median of the array obtained after merging a[] and b[]. Note: Since the size of the merged array will always be even, the median will be the average of the middle two numbers.Input: a[] = [1, 12, 15, 26, 38], b[] = [2, 13, 17
15+ min read
Find position of an element in a sorted array of infinite numbersGiven a sorted array arr[] of infinite numbers. The task is to search for an element k in the array.Examples:Input: arr[] = [3, 5, 7, 9, 10, 90, 100, 130, 140, 160, 170], k = 10Output: 4Explanation: 10 is at index 4 in array.Input: arr[] = [2, 5, 7, 9], k = 3Output: -1Explanation: 3 is not present i
15+ min read
Pair Sum in a Sorted and Rotated ArrayGiven an array arr[] of size n, which is sorted and then rotated around an unknown pivot, the task is to check whether there exists a pair of elements in the array whose sum is equal to a given target value.Examples : Input: arr[] = [11, 15, 6, 8, 9, 10], target = 16Output: trueExplanation: There is
10 min read