How to Split a String by a Delimiter in C++?
In C++, a string stores a sequence of characters that represents some textual data. The delimiters are used to separate those sequences of characters in a string. This process is called splitting or tokenization. In this article, we will learn how to split a string by a delimiter in C++....
read more
Count words that appear exactly two times in an array of words
Given an array of n words. Some words are repeated twice, we need to count such words....
read more
Quick way to check if all the characters of a string are same
Given a string, check if all the characters of the string are the same or not....
read more
How to Initialize a Vector with Values between a Range in C++?
In C++, vectors are dynamic containers that can resize automatically when elements are inserted or deleted during the runtime. In this article, we will learn how to initialize a vector with a range of values in C++....
read more
unordered_multimap max_load_factor() function in C++ STL
The unordered_multimap::max_load_factor() is a built-in function in C++ STL which returns the maximum load factor of the unordered_multimap container. This function also provides with an option of setting the maximum load factor....
read more
unordered_multiset key_eq() function in C++ STL
The unordered_multiset::key_eq() is a built-in function in C++ STL which returns a boolean value according to the comparison. It depends on the key equivalence comparison predicate used by the unordered_multiset container. The key equivalence comparison is a predicate which takes two arguments and returns a boolean value indicating whether they are to be considered equivalent. It returns true if they are equivalent else it returns false. It is adopted by the container on construction and is similar to the (==) operator used in the comparison. Syntax:...
read more
forward_list max_size() in C++ STL with Examples
The forward_list::max_size() is a built-in function in C++ STL which returns the maximum number of elements a forward_list container can hold...
read more
Array of Sets in C++ STL
An array is a collection of items stored at contiguous memory locations. It is to store multiple items of the same type together. This makes it easier to get access to the elements stored in it by the position of each element....
read more
How to Find All Occurrences of an Element in a List in C++?
In C++, std::list is a sequence container that allows non-contiguous memory allocation. As such, it is a doubly linked list that can be traversed in both directions. In this article, we will learn how to find all occurrences of a specific element in a list in C++....
read more
How to Traverse Vector using const_iterator in C++?
In C++, a const_iterator is a type of iterator that points to constant content means by using a const_iterator, we can read from but cannot write to the element it points to. In this article, we will learn how to use a const_iterator with a vector in C++ STL....
read more
How to Find Average of All Elements in a Deque in C++?
In C++, a deque (double-ended queue) is a container class template that allows fast insertion and deletion at both its beginning and end. In this article, we will learn how to find the average (or mean) of all elements in a deque in C++....
read more
How to Find Mode of All Elements in a Deque in C++?
In C++, deque is a container provided by the STL library of C++ that allows insertion and deletion from both ends. The mode of a deque represents the element that appears most frequently in the container. In this article, we will learn how to find the mode of all elements in a deque in C++....
read more