# Category Archives: Sorting

Given a string R(x) of length n representing an expression having the set of words under the given grammar: For every lowercase letter x, R(x)… Read More
Given two arrays arr1[] and arr2[], both of size N and an integer X, the task is to check if the sum of same-indexed elements… Read More
Given an array arr[] of size N and an integer D, the task is to make all array elements equal by incrementing or decrementing minimum… Read More
Given an array A[] of size N and a positive integer K ( which will always be a factor of N), the task is to… Read More
Given a mountain array arr[] and an integer X, the task is to find the smallest index of X in the given array. If no… Read More
Given two arrays S[] and E[] of size N denoting starting and closing time of the shops and an integer value K denoting the number… Read More
Given an array arr[] consisting of N integers whose absolute values are distinct and an integer K, the task is to find such an arrangement… Read More
Given an array arr[] of size N, and an integer K, the task is to find the minimum count of pairs required to be removed… Read More
In this article, we will discuss the difference between the Insertion sort and the Selection sort: Insertion sort is a simple sorting algorithm that works… Read More
Given two positive integers A and C, the task is to check if a number B exists such that A + B = C and… Read More
Given an array arr[] of size N, the task is to find the total count of operations required to remove all the array elements such… Read More
Given an array arr[] of size N and a positive integer K, the task is to find the minimum possible cost to split the array… Read More
Given an array arr[] consisiting of first N natural numbers (N is even), the task is to find a sequence of swaps that can sort… Read More
Given an array arr[] of size N, the task is to find the smallest possible remaining array element by repeatedly removing a pair, say (arr[i],… Read More
Given an array arr[] and an integer K, the task is to find the array element from indices not divisible by K whose product of… Read More