Given three arrays X[], Y[], and Z[] each consisting of N integers, the task is to find the maximum number of triplets (X[i], Y[i], Z[i])… Read More

# Category Archives: Sorting

Given an array arr[] of size N, the task is to sort the array in descending order starting from the mid of the array having… Read More

Given two arrays dist[] and speed[] consisting of N integers, where dist[i] is the initial distance of the ith giant from the city and speed[i]… Read More

Cocktail Sort is a variation of Bubble sort. Cocktail Sort traverses through a given array in both directions alternatively. In order to know more about… Read More

Given an array, arr[] of size N and an integer K, the task is to find the number of ways of selecting K array elements,… Read More

Array Of Strings To sort an array of strings in Java, we can use Arrays.sort() function. // A sample Java program to // sort an… Read More

Given the head of a Linked List of size N, consisting of binary integers 0s and 1s, the task is to sort the given linked… Read More

Given an array arr[] consisting of N integers, the task is to find the minimum number of increment/decrement by 1 required to be performed on… Read More

Given an array arr[] consisting of N integers and an integer R, denoting the cutoff rank, the task is to count the number of array… Read More

Gnome Sort also called Stupid sort, is based on the concept of a Garden Gnome sorting his flower pots. In order to know more about… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to split the given array into K non-overlapping subsets such… Read More

Given an array arr[] consisting of N integers, the task is to find the minimum cost to sort the given array arr[] in ascending order… Read More

Given two arrays A[] and B[] consisting of N and M integers, the task is to find the minimum number of operations required to make… Read More

Given N horizontal lines represented by an array position[][] of size N, where position[i] represents the ith horizontal line which has x-coordinates from position[i][0] to… Read More