Transpose Graph

Problem Statement The problem “Transpose graph” states that you are given a graph and you need to find the transpose of the given graph. Transpose: Transpose of a directed graph produces another graph with same edge & node configurations but the direction of all the edges have been reversed. Example …

Sort elements by frequency

Problem Statement You are given an array of integers, some numbers are repeated in it. The problem statement asks to print the number in the array in decreasing order according to their frequency that is to sort elements by frequency. Example arr[]={3,4,3,1,2,9,2,9,2,5 } 2 2 2 3 3 9 9 …

Count minimum steps to get the given desired array

Problem Statement Suppose you have an array containing only integer 0 as all of its elements. Consider, you are given an array of length n having all 0s in which we have to convert the 0s to the given required array. We can name the required array as the desiredArr …

Sort Elements by Frequency II

Problem Statement In the “Sort Elements by Frequency II” problem we have given an array a[]. Sort the array according to the frequency of the elements where the higher frequency element comes first then others. Input Format The first and only one line containing an integer n. Second-line containing n …

Sort Elements by Frequency of Occurrences

Problem Statement In sort elements by frequency of occurrences problem, we have given an array a[]. Sort array elements in such a way that the element with the highest number of occurrences comes first. If the number of occurrences is equal then the print the number which appeared first in …