## Find k maximum elements of array in original order

Given an array arr[] and an integer k, we need to print k maximum elements of given array. The elements should printed in the order… Read More »

Quick Links for Sorting

Sorting Terminology |

Stability in sorting algorithms |

Time Complexities of all Sorting Algorithms |

External Sorting |

Given an array arr[] and an integer k, we need to print k maximum elements of given array. The elements should printed in the order… Read More »

Earlier we have discussed on how to check if both halves of the string have same set of characters. Now, we further extend our problem… Read More »

Given a list of distinct unsorted integers, find the pair of elements that have the smallest absolute difference between them? If there are multiple pairs,… Read More »

Insertion Sort is suitable for arrays of small size. It also achieves best-case complexity of O(n) if the arrays are already sorted. We have discussed… Read More »

Given an array of N integers with duplicates allowed. All elements are ranked from 1 to N if they are distinct. If there are say… Read More »

Given an array A[] consisting 0s, 1s and 2s, write a function that sorts A[]. The functions should put all 0s first, then all 1s… Read More »

Given 3 arrays (A, B, C) which are sorted in ascending order, we are required to merge them together in ascending order and output the… Read More »

Like C++ sort(), Java sort() and other languages, python also provides built in function to sort. The sort function can be used to sort the… Read More »

Given a sentence, sort it alphabetically in ascending order. Examples: Input : to learn programming refer geeksforgeeks Output : geeksforgeeks learn programming refer to Input… Read More »

In this article, we will learn how to sort any list, according to the second element of the sublist present within the main list. We… Read More »

In this article we will discuss how to implement QuickSort using random pivoting. In QuickSort we first partition the array in place such that all… Read More »

Merge Sort is a popular sorting technique which divides an array or list into two halves and then start merging them when sufficient depth is… Read More »

Given a string containing lowercase and uppercase letters.sort it in such a manner such that the uppercase and lowercase letter comes in an alternate manner… Read More »

You are given a sequence of numbers arr[0], arr[1], …, arr[N – 1] and a positive integer K. In each operation, you may subtract K… Read More »

Given an array of non-negative integers. Our task is to find minimum number of elements such that their sum should be greater than the sum… Read More »