Skip to content

Tag Archives: Order-Statistics

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 four… Read More
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 most occurrences, i.e., the top k… Read More
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 no. of… 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
Given 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: arr[]… 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