# Category Archives: Sorting

## Count of all pairs in an Array with minimum absolute difference

Given an integer array arr[] of size N, the task is to count the total number of distinct pairs having minimum absolute difference. Examples: Input:… Read More »

## Replace each element of Array with it’s corresponding rank

Given an array arr[] of N integers, the task is to replace each element of Array with their rank in array. The rank of an… Read More »

## Check if a decreasing Array can be sorted using Triple cyclic shift

Given an arr[] of size N whose elements are sorted in descending order. The task is to find if the given array can be sorted… Read More »

## Maximum distance between two points in coordinate plane using Rotating Caliper’s Method

Prerequisites: Graham Scan’s Convex Hull, Orientation. Given a set of N points in a coordinates plane, the task is to find the maximum distance between… Read More »

## Sort a Bitonic Array

Given a bitonic array arr[] the task is to sort the given bitonic array. A Bitonic Sequence is a sequence of numbers that is first… Read More »

QuickSort is a popular sorting technique based on divide and conquer algorithm. In this technique, an element is chosen as a pivot and the array… Read More »

## Sort Array such that smallest is at 0th index and next smallest it at last index and so on

Given an array, arr[] of N integers, the task is to rearrange the array elements such that the smallest element is at the 0th position,… Read More »

## Split array into K subsets to maximize their sum of maximums and minimums

Given an integer K and an array A[ ] whose length is multiple of K, the task is to split the elements of the given… Read More »

## Min steps to empty an Array by removing a pair each time with sum at most K

Given an array arr[] and a target value K. The task is to find the minimum number of steps required to take all elements from… Read More »

## Select K elements from an array whose maximum value is minimized

Given an array arr[] having N integers and an integer K, the task is to select K elements from the given array such that sum… Read More »

## Sorting boundary elements of a matrix

Given a matrix mat[][] of size M*N, the task is to sort only the border elements of the matrix in the clockwise direction and print… Read More »

## The Skyline Problem | Set 2

Given n rectangular buildings in a 2-dimensional city, computes the skyline of these buildings, eliminating hidden lines. The main task is to view buildings from… Read More »

## Check if the given point lies inside given N points of a Convex Polygon

Given coordinates of the N points of a Convex Polygon. The task is to check if the given point (X, Y) lies inside the polygon.… Read More »

## Find least non-overlapping number from a given set of intervals

Given an array interval of pairs of integers representing the starting and ending points of the interval of size N. The task is to find… Read More »

## Flattening a linked list | Set 2

Given a linked list where every node represents a linked list and contains two pointers of its type: Pointer to next node in the main… Read More »