Hard Problems on Array Searching

Similar Reads

Linear Search:

Linear Search is defined as a sequential search algorithm that starts at one end and goes through each element of a list until the desired element or group of elements is found. Otherwise, the search continues till the end of the data set. This has a time complexity of O(N) where ‘N’ is the length of the array...

Binary Search:

Binary Search is a searching algorithm used in a sorted array. In this algorithm, the element is found by repeatedly dividing the search interval in half and deciding the next interval to find the element. This searching algorithm has a time complexity of O(log 2 N) where ‘N’ is the length of the array. The only thing to note is that the array must be sorted in increasing or decreasing order....

Ternary Search:

Ternary search is a divide and conquer algorithm that can be used to find an element in an array. It is similar to binary search where we divide the array into two parts but in this algorithm, we divide the given array into three parts and determine which has the key (searched element). This algorithm also has the constraint that the array must be sorted. The time complexity for this algorithm is O(log 3 N) where ‘N’ is the size of the array....

Easy Problems on Array Searching:

Program to find the minimum (or maximum) element of an array Last duplicate element in a sorted array Most frequent element in an array Least frequent element in an array Find a Fixed Point in a given array Find the element that appears once Find common elements in three sorted arrays Check for Majority Element in a sorted array Find the Missing Number Find the Number Occurring Odd Number of Times Find the first repeating element in an array of integers Find lost element from a duplicated array Third largest element in an array of distinct elements Find element in a sorted array whose frequency is greater than or equal to n/2. Consecutive steps to roof top Pairs such that one is a power multiple of other...

Medium Problems on Array Searching:

Searching in an array where adjacent differ by at most k Ceiling in a sorted array Find the only repetitive element between 1 to n-1 Find a peak element Leaders in an array Equilibrium index of an array Find the two repeating elements in a given array Find a triplet that sum to a given value Count triplets with sum smaller than a given value Find the two numbers with odd occurrences in an unsorted array Check if a given array contains duplicate elements within k distance from each other Count pairs with given sum Binary search in sorted vector of pairs Maximum difference between groups of size two Find first k natural numbers missing in given array Noble integers in an array (count of greater elements is equal to value) Number of pairs with maximum sum...

Hard Problems on Array Searching:

Majority Element Number of unique triplets whose XOR is zero Find position of an element in a sorted array of infinite numbers Find four elements that sum to a given value Search an element in an unsorted array using minimum number of comparisons k-th missing element in sorted array Median of two sorted arrays with different sizes in O(log(min(n, m))) Find number of pairs in an array such that their XOR is 0 Closest numbers from a list of unsorted integers Minimum product subset of an array Maximum difference between two subsets of m elements Find k maximum elements of array in original order Number of local extrema in an array...