# Tag Archives: Order-Statistics

Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the… Read More
Given an array of n numbers. Your task is to read numbers from the array and keep at-most K numbers at the top (According to… Read More
We are given a row-wise sorted matrix of size r*c, we need to find the median of the matrix given. It is assumed that r*c… Read More
Given that integers are being read from a data stream. Find the median of all the elements read so far starting from the first integer… Read More
Given an array of N numbers and a positive integer K. The problem is to find K numbers with the most occurrences, i.e., the top… Read More
Given a Binary Search Tree, find the median of it.  If number of nodes are even: then median = ((n/2th node + ((n)/2th+1) node) /2 … Read More
Given an array of integers, our task is to write a program that efficiently finds the second-largest element present in the array.  Example: Input: arr[]… Read More
We are given an array of size n containing positive integers. The absolute difference between values at indices i and j is |a[i] – a[j]|.… Read More
Given two integer arrays arr1[] and arr2[] sorted in ascending order and an integer k. Find k pairs with smallest sums such that one element… Read More
tGiven an array of n distinct elements, the task is to find all elements in array which have at-least two greater elements than themselves. Examples… Read More
Given Binary Search Tree. The task is to find sum of all elements smaller than and equal to Kth smallest element. Examples:  Input : K… Read More
Given a positive number k and an undirected graph of N nodes, numbered from 0 to N-1, each having a weight associated with it. Note… Read More
Given an array with all distinct elements, find the largest three elements. Expected time complexity is O(n) and extra space is O(1).  Examples : Input:… Read More
Given a Binary Search Tree (BST) and a positive integer k, find the k’th smallest element in the Binary Search Tree. For example, in the following… Read More
Given an infinite stream of integers, find the Kth largest element at any point of time. Note: Here we have a stream instead of a… Read More