Welcome To Tutorialspoint.dev
Officially launched 18th May 2019

# Sort elements by frequency Set 1

Print the elements of an array in the decreasing frequency if 2 numbers have same frequency then print the one which came first. Examples: Input: arr[] = {2, 5, 2, ...

# Sort a nearly sorted (or K sorted) array

Given an array of n elements, where each element is at most k away from its target position, devise an algorithm that sorts in O(n log k) time. For example, let us ...

# Structure Sorting (By Multiple Rules) in C++

Prerequisite : Structures in C Name and marks in different subjects (physics, chemistry and maths) are given for all students. The task is to compute total marks and ...

# Sort a linked list of 0s, 1s and 2s

Given a linked list of 0s, 1s and 2s, sort it. Source: Microsoft Interview | Set 1 Recommended: Please solve it on &#x201C;PRACTICE&#x201D; first, before moving on t...

# Comparator function of qsort() in C

Standard C library provides qsort() that can be used for sorting an array. As the name suggests, the function uses QuickSort algorithm to sort the given array. Follo...

# Sort in C++ Standard Template Library (STL)

Sorting is one of the most basic functions applied to data. It means arranging the data in a particular fashion, which can be increasing or decreasing. There is a bui...

# Efficient Huffman Coding for Sorted Input Greedy Algo-4

We recommend to read following post as a prerequisite for this. Greedy Algorithms | Set 3 (Huffman Coding) Time complexity of the algorithm discussed in above post is...

# stable_sort() in C++ STL

Like std::sort(), stable_sort also sorts an array. The syntax is also same. // C++ program to demonstrate default behaviour of // sort() in STL. #include ...

# sort_heap function in C++

The sort_heap( ) is an STL algorithm which sorts a heap within the range specified by start and end. Sorts the elements in the heap range [start, end) into ascending ...

# std::sort() in C++ STL

We have discussed qsort() in C. C++ STL provides a similar function sort that sorts a vector or array (items with random access). Below is a simple program to show...