## Count smaller elements on right side using Set in C++ STL

Write a function to count number of smaller elements on right of each element in an array. Given an unsorted array arr[] of distinct integers,… Read More »

## Array with GCD of any of its subset belongs to the given array

Given a set of N elements such that N, task is to generate an array such that the GCD of any subset of the generated… Read More »

## Sorting array using Stacks

Given an array of elements, task is to sort these elements using stack. Prerequisites : Stacks Examples : Input : 8 5 7 1 9… Read More »

## Numbers within a range that can be expressed as power of two numbers

Given two integers L and R. Find the number of perfect powers in the given range [L, R]. A number x is said to be… Read More »

## C++ set for user define data type

The C++ STL set is a data structure used to store the distinct value in ascending or descending order. By default, we can use it… Read More »

## Print sorted distinct elements of array

Given an array that might contain duplicates, print all distinct elements in sorted order. Examples: Input : 1, 3, 2, 2, 1 Output : 1… Read More »

## Smallest greater elements in whole array

An array is given of n length, and we need to calculate the next greater element for each element in given array. If next greater… Read More »

## Binary Tree to Binary Search Tree Conversion using STL set

Given a Binary Tree, convert it to a Binary Search Tree. The conversion must be done in such a way that keeps the original structure… Read More »

## C++ programming and STL facts

Assign value by a pair of {} to a container filter_none edit close play_arrow link brightness_4 code // Lots of programmers write code  // like… Read More »

## Print Binary Tree levels in sorted order | Set 2 (Using set)

Given a tree, print the level order traversal in sorted order. Examples : Input : 7 / \ 6 5 / \ / \ 4… Read More »

## set::clear in C++ STL

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value… Read More »

## set::begin() and set::end() in C++ STL

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value… Read More »

## set::erase in C++ STL

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value… Read More »

## set::empty() in C++ STL

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value… Read More »

## set::size() in C++ STL

Sets are containers that store unique elements following a specific order. Internally, the elements in a set are always sorted. Sets are typically implemented as… Read More »