Why does the C++ STL not provide any “tree” containers?
The Standard Template Library (STL) is a set of C++ template classes to provide common programming data structures and functions. It is a library of container classes, algorithms, functions and iterators....
read more
One97 Interview Experience | Set 3 (Backend/Node js Developer)
Round 1 Q1. Multiply two 2d matrices...
read more
std::memchr in C++
C++ offers various standard template library functions to be used. One of them is memchr() function which is used to search for the first occurrence of a character in a specified number of characters....
read more
How to Find the Minimum Element in a List in C++?
In C++, a list is a sequence container provided by the STL library that stores data in non-contiguous memory locations efficiently. In this article, we will learn how to find the minimum element in a list in C++....
read more
vector insert() Function in C++ STL
std::vector::insert() is a built-in function in C++ STL that inserts new elements before the element at the specified position, effectively increasing the container size by the number of elements inserted....
read more
vector::push_back() and vector::pop_back() in C++ STL
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container....
read more
Iterators in C++ STL
Prerequisite : Introduction to Iterators Iterators are used to point at the memory addresses of STL containers. They are primarily used in sequences of numbers, characters etc. They reduce the complexity and execution time of the program....
read more
Unordered Sets in C++ Standard Template Library
An unordered_set is an unordered associative container implemented using a hash table where keys are hashed into indices of a hash table so that the insertion is always randomized. All operations on the unordered_set take constant time O(1) on an average which can go up to linear time O(n) in the worst case which depends on the internally used hash function, but practically they perform very well and generally provide a constant time lookup operation.  The unordered_set can contain a key of any type – predefined or user-defined data structure but all the keys must be unique. It is defined inside <unordered_set> header file as std::unordered_set class....
read more
How to Push All Elements from a Vector to a Queue in C++?
In C++, vectors are dynamic arrays while the queue is a data structure that follows the FIFO (First In First Out) property. In this article, we will learn how to push all elements from a vector to a queue in C++....
read more
Check if two trees are Mirror
Given two Binary Trees, write a function that returns true if two trees are mirror of each other, else false. For example, the function should return true for following input trees....
read more
How to Implement Custom Hash Functions for User-Defined Types in std::unordered_map?
In C++ std::unordered_map is a data structure that implements a hash table and allows fast access to each element based on its key. However, when we want to use user-defined types as keys, we need to provide a custom hash function. In this article, we will learn how to implement a custom hash function for user-defined types in std::unordered_map....
read more
C++ Program to Find the Frequency of Elements in an Array
In C++, arrays are a type of data structure that can store a fixed-size sequential collection of elements of the same type. In this article, we will learn how to find the frequency of elements in an array in C++....
read more