##
Subarray Inversions
August 10, 2017

We have an array A of n integers that we’re planning on sorting. Specifically, we want to know how close the array is to sorted.… Read More »

August 10, 2017

We have an array A of n integers that we’re planning on sorting. Specifically, we want to know how close the array is to sorted.… Read More »

March 26, 2017

Given a permuted array of length N of first N natural numbers, we need to tell the minimum number of swaps required in the sorted… Read More »

March 8, 2017

Given an array of integer values which need to be sorted by only one operation – subarray rotation where subarray size should be 3. For… Read More »

December 15, 2016

Given an array of integers arr[0..n-1], count all pairs (arr[i], arr[j]) in the such that i*arr[i] > j*arr[j], 0 =< i < j < n.… Read More »

November 25, 2016

Given an array arr[] of non negative integers. We can perform a swap operation on any two adjacent elements in the array. Find the minimum… Read More »

November 10, 2016

Given an array, an inversion is defined as a pair a[i], a[j] such that a[i] > a[j] and i < j. We are given two… Read More »

July 9, 2016

A surpasser of an element of an array is a greater element to its right, therefore x[j] is a surpasser of x[i] if i <… Read More »

December 21, 2015

Given an array arr[] of size n. Three elements arr[i], arr[j] and arr[k] form an inversion of size 3 if a[i] > a[j] >a[k] and… Read More »

December 18, 2015

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count… Read More »

December 17, 2015

November 22, 2014

What is an inversion? Given an array arr[], a pair arr[i] and arr[j] forms an inversion if arr[i] < arr[j] and i > j.

January 5, 2010