The idea is to use Reservoir Sampling. Following are the steps. This is a simpler version of Reservoir Sampling as we need to select only one key.
Tag - the complexity of linear search algorithm is
Linear search in C - C Programming - The following code implements linear search (Searching algorithm) which is used to find whether a given number.
Interpolation search vs Binary search - Searching and Sorting - On average the interpolation search makes about log(log(n)) comparisons(if the elements are...
Linear Search - searching and sorting - algorithm -A simple approach is to do linear search, Start from the leftmost element of arr and one by one compare