# Tag Archives: Order-Statistics

## Minimum number of elements to add to make median equals xNovember 5, 2017

A median in an array with the length of n is an element which occupies position number (n+1)/2 after we sort the elements in the… Read More »

## Quickselect AlgorithmNovember 4, 2017

Quickselect is a selection algorithm to find the k-th smallest element in an unordered list. It is related to the quick sort sorting algorithm. Examples:… Read More »

## Mean and Median of a matrixOctober 18, 2017

Given a sorted matrix of size n*n. Calculate the mean and median of the matrix . Examples: Input : 1 2 3 4 5 6… Read More »

## Program for Mean and median of an unsorted arrayOctober 17, 2017

Given n size unsorted array, find its mean and median. Mean of an array = (sum of all elements) / (number of elements) Median of… Read More »

## Minimum product of k integers in an array of positive IntegersOctober 15, 2017

Given an array of n positive integers. We are required to write a program to print the minimum product of k integers of the given… Read More »

## K-th Largest Sum Contiguous SubarrayOctober 6, 2017

Given an array of integers. Write a program to find the K-th largest sum of contiguous subarray within the array of numbers which has negative… Read More »

## Maximum difference between group of k-elements and rest of the array.September 30, 2017

You are given an array of n elements. You have to divide the given array into two group such that one group consists exactly k… Read More »

## M-th smallest number having k number of set bits.September 24, 2017

Given two non-negative integers m and k. The problem is to find the m-th smallest number having k number of set bits. Constraints: 1 <=… Read More »

## Order statistic tree using fenwick tree (BIT)August 4, 2017

Given an array of integers with limited range (0 to 1000000). We need to implement an Order statistic tree using fenwick tree. It should support… Read More »

## K’th Smallest/Largest Element using STLJuly 30, 2017

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 »

## Find top k (or most frequent) numbers in a streamJuly 29, 2017

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 »

## Find median in row wise sorted matrixJuly 15, 2017

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… Read More »

## Median of Stream of Running Integers using STLJuly 14, 2017

Given that integers are being read from a data stream. Find median of all the elements read so far starting from the first integer till… Read More »

## Find k numbers with most occurrences in the given arrayJune 27, 2017

Given an array of n numbers and a positive integer k. The problem is to find k numbers with most occurrences, i.e., the top k… Read More »

## Find median of BST in O(n) time and O(1) spaceJune 16, 2017

Given a Binary Search Tree, find median of it. If no. of nodes are even: then median = ((n/2th node + (n+1)/2th node) /2 If… Read More »