## QuickSelect (A Simple Iterative Implementation)

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 »

## Find the K-th minimum element from an array concatenated M times

Given an Array arr[] and two integers K and M. The problem is to find the K-th Minimum element after concatenating the array to itself… Read More »

## Find m-th smallest value in k sorted arrays

Given k sorted arrays of possibly different sizes, find m-th smallest value in the merged array. Examples: Input: m = 5 arr[][] = { {1,… Read More »

## Average of remaining elements after removing K largest and K smallest elements from array

Given an array of N integers. The task is to find the average of the numbers after removing k largest elements and k smallest element… Read More »

## Sum and product of k smallest and k largest composite numbers in the array

Given an integer k and an array of integers arr, the task is to find the sum and product of k smallest and k largest… Read More »

## Average of max K numbers in a stream

Given a list of ‘N’ numbers, and an integer ‘K’. The task is to print the average of max ‘K’ numbers after each query where… Read More »

## Find the second last node of a linked list in single traversal

Given a linked list. The task is to find the second last node of the linked list using a single traversal only. Examples: Input :… Read More »

## Find K items with the lowest values

Given a list of items and their values. The task is to find k items with the lowest value. It is possible that two items… Read More »

## kth smallest/largest in a small range unsorted array

Find kth smallest or largest element in an unsorted array, where k<=size of array. It is given that elements of array are in small range.… Read More »

## Multi-set for user defined data type

You are given Q queries. Each query contains an integer k and a person’s information i.e, first name, last name, age. For each query, we… Read More »

## Sampling Theory

In the world of Statistics, the very first thing to be done before any estimation is to create a Sample set from the entire Population… Read More »

## K’th Largest element in BST using constant extra space

Given a binary search tree, task is to find Kth largest element in the binary search tree. Example: Input : k = 3 Root of… Read More »

## Find k-th smallest element in given n ranges

Given n and q, i.e, the number of ranges and number of queries, find the kth smallest element for each query (assume k>1).Print the value… Read More »

## Top three elements in binary tree

We have a simple binary tree and we have to print the top 3 largest elements present in the binary tree. Examples: Input : 1… Read More »

## K maximum sums of overlapping contiguous sub-arrays

Given an Array of Integers and an Integer value k, find out k sub-arrays(may be overlapping) which have k maximum sums. Examples: Input : arr… Read More »