## Implementing Counting Sort using map in C++

Counting Sort is one of the best sorting algorithms which can sort in O(n) time complexity but the disadvantage with the counting sort is it’s… Read More »

Counting Sort is one of the best sorting algorithms which can sort in O(n) time complexity but the disadvantage with the counting sort is it’s… Read More »

Given a map, the task is to swap the Keys of this map with its values, in C++. Examples: Input: map = {‘e’, 1 },… Read More »

Given a grid of size H*W with all cells initially white. Given N pairs (i, j) in an array, for each pair, paint cell (i,… Read More »

Given an array arr[] of integers of size N and an integer K. One can perform the Bitwise XOR operation between any array element and… Read More »

Given two arrays a1[] and a2[], print elements of a1 in such a way that the relative order among the elements will be the same… Read More »

Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2[] is a subset of arr1[] or not. Both the arrays are not in sorted order. It… Read More »

Given two arrays A[] and B[] of equal sizes i.e. N containing integers from 1 to N. The task is to find sub-arrays from the… Read More »

Given four arrays containing integer elements and an integer sum, the task is to count the quadruplets such that each element is chosen from a… Read More »

Given three arrays a[], b[] and c[] of N elements representing the three sides of N triangles. The task is to find the number of… Read More »

Given a string of lowercase alphabets. The task is to check whether the frequency of alphabets in this string, after arranging in any possible manner,… Read More »

Given two integer arrays arr[] and cost[] where cost[i] is the cost of choosing arr[i]. The task is to choose a subset with at least… Read More »

map::get_allocator() is a built in function in C++ STL which is used to get allocator of container map. Syntax: Allocator_type get_allocator() Parameters: This function does… Read More »

Given an array of N positive elements find the number of quadruple, (i, j, k, m) such that i < j < k < m… Read More »

If we wish to delete the last element from a map, we can use following methods : using prev(mp.end()) : what prev function do is,… Read More »

Map stores the elements in sorted order of keys. Now if we want to traverse it in reverse order we will use reverse_iterator of map.… Read More »