Skip to content

Category Archives: Sorting

Given two arrays arr1[] and arr2[] of size N and N – 1 respectively. Each value in arr2[] is obtained by adding a hidden value… Read More
Given an array arr containing N unique integers. The task is to calculate the minimum number of deques required to make the array sorted. Example: … Read More
Given an array arr[] of N integers and a positive integer K, the task is to find the minimum number of operations required to reduce… Read More
This is basically a variation of bubble-sort. This algorithm is divided into two phases- Odd and the Even Phase. In the odd phase, we perform… Read More
Given a sorted array arr[] and a positive integer D, the task is to find the minimum and the maximum number of array elements that… Read More
Given a string S of size N, the task is to find the maximum sum of values assigned to all the alphabets of the string… Read More
Given an integer N denoting the numbers of cards in a specific deck and an array arr[] of size N where ith element denotes the… Read More
Given an array arr[] of N positive integers and a range [L, R], the task is to find the maximum subset-sum such that the difference… Read More
Given a positive integer N and an array arr[] of size M of the type {L, R, C} such that C is the cost of… Read More
Given a queue consisting of the first N natural numbers and queries Query[][] of the type {E, X}, the task is to perform the given… Read More
Given an array arr[] of size N, the task is to find 4 indices i, j, k, l such that 0 <= i, j, k,… Read More
Given a string S of size N, the task is to sort the string based on their ASCII values. Examples: Input: S = “Geeks7”Output: 7GeeksExplanation:… Read More
Given two arrays A[] and B[] both consisting of N positive integers, the task is to find the minimum size of the subsets of pair… Read More
Given an array arr[] of 2*N integers such that it consists of all elements along with the twice values of another array, say A[], the… Read More
Given an array arr[] of sides of N triangles, the task is to sort the given sides of triangles on the basis of the increasing… Read More