Given an array of integer arr[] and an integer k, the task is to find the median of each window of size k starting from… Read More

# Tag Archives: median-finding

Given a sequence A1, A2, A3, … An of distinct integers. The task is to find the last 2 remaining elements after removing the median… Read More

Given an array arr[] of N integers, the task is to find an element x from the array such that |arr[0] – x| + |arr[1]… Read More

In normal median, we find a point that has minimum sum of distances. Similar concept applies in 2-D space. Given N points in 2-D space, the… Read More

Given an integer K and a matrix of N rows and M columns, the task is to find the minimum number of operations required to… Read More

Given A sorted linked list of elements. The task is to find the median in the given Sorted Linked List.We know that median in a sorted… Read More

Given an array of n elements. The task is to print the array in a form such that the median of that array is maximum.… Read More

Given an array of integers where . In one operation you can either Increment/Decrement any element by 1. The task is to find the minimum operations… Read More

Given an array, we need to find the sum of elements of an array after changing the element as arr[i] will become abs(arr[i]-x) where x… Read More

This is an extension of the median of two sorted arrays of equal size problem. Here we handle arrays of unequal size also. Examples: Input:… Read More

Given two sorted arrays, a[] and b[], task is to find the median of these sorted arrays, in O(log(min(n, m)), when n is the number… Read More

Given an n sized unsorted array, find median and mode using counting sort technique. This can be useful when array elements are in limited range.… Read More

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

Given a string s written in median form, change it back to the original string. The median letter in a string is the letter that… Read More