Skip to content

Tag Archives: STL

Given a set S consisting of N integers and an element K, the task is to find the index of the element K in the… Read More
In C++, vectors are dynamic arrays, that can grow or shrink and their storage is handled by the container itself. There are two ways of… Read More
Design a data structure that supports the following operations in queue efficiently: push__front(x): Insert an element at the front of the queue. push__middle(x): Inserts element… Read More
find(): The find() function is used to search the element in the given range and every STL container has the functionality to search the element… Read More
In this article, we will discuss the time and space complexity of some C++ STL classes. Characteristics of C++ STL: C++ has a low execution… Read More
Prerequisite: Vectors in C++ STL Vectors are known as dynamic arrays with the ability to resize themselves automatically when an element is inserted or deleted,… Read More
Given a string S and a character C, the task is to remove all the occurrences of the character C from the given string. Examples:… Read More
Maps are associative containers that store elements in a specific order. It stores elements in a combination of key values and mapped values. Syntax: map<data… Read More
Given an array arr[] of size N representing integers required to be read as a data stream, the task is to calculate and print the… Read More
Given a vector of pairs arr[] and Q queries in the form of pairs in an array Queries[], the task for each query is to… Read More
Higher-order functions are functions that take functions as an argument. It is used in functional languages which is not used in C++ are, although this… Read More
The list doesn’t have random access operator [] to access elements by indices, because std::list internally store elements in a doubly-linked list. So, to access… Read More
Map in STL: Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No… Read More
Given a 2D array arr[][] of the form {start, end} representing the start and end time of N meetings, also given two arrays entrance[] and… Read More
Joining two different tables on their matching columns can be done using nested loops, but a more efficient and scalable way is to use multimaps.… Read More