Skip to content

Tag Archives: cpp-unordered_set

The unordered_set::clear() function is a built-in function in C++ STL which is used to clear an unordered_set container. That is, this function removes all of… Read More
The unordered_set::rehash() is a built-in function in C++ STL which is used to set the number of buckets in the container of unordered_set to given… Read More
Given an array where every element occurs ‘a’ times, except one element which occurs b (a>b) times. Find the element that occurs b times. Examples:  … Read More
Differences :  | set | unordered_set --------------------------------------------------------- Ordering | increasing order | no ordering | (by default) | Implementation | Self balancing BST | Hash… Read More
Given two arrays with size n, maximize the first array by using the elements from the second array such that the new array formed contains… Read More
Java import*;   class GFG {   public static void main(String[] args) {                   System.out.println("Enter The String : ");         String str = "geeksforgeeks";         StringBuffer sb… Read More
Given an array of length N that contains only integers, the task is to print the special numbers of array. A number in this array… Read More
Prerequisites:  Disjoint Set Data Structure Set Unordered_Map Disjoint Set data structure is used to keep track of a set of elements partitioned into a number… Read More
A pair of strings when concatenated is said to be a ‘Pandigital Concatenation’ if their concatenation consists of all digits from (0 – 9) in… Read More
Given an array of size N filled with numbers from 1 to N-1 in random order. The array has only one repetitive element. The task… Read More
Given a sorted array of distinct positive integers, print all triplets that form AP (or Arithmetic Progression) Examples :  Input : arr[] = { 2,… Read More
Given inorder and level-order traversals of a Binary Tree, construct the Binary Tree. Following is an example to illustrate the problem. Examples:  Input: Two arrays… Read More
Given N numbers with no duplicates, count the number of unique triplets (ai, aj, ak) such that their XOR is 0. A triplet is said… Read More
Given two Binary Search Trees consisting of unique positive elements, we have to check whether the two BSTs contain the same set of elements or… Read More
In C++ Standard Template Library, set, multiset, unordered_set, unordered_multiset are used to store elements. Although they are similar but differ from each other in some… Read More