## vector data() function in C++ STL

The std::vector::data() is an STL in C++ which returns a direct pointer to the memory array used internally by the vector to store its owned… Read More »

The std::vector::data() is an STL in C++ which returns a direct pointer to the memory array used internally by the vector to store its owned… Read More »

The vector::emplace() is an STL in C++ which extends container by inserting new element at position. Reallocation happens only if there is a need of… Read More »

Given K arrays of different size. The task is to check if there exist any two arrays which have the same sum of elements after… Read More »

Given N, print the sequence of a minimum number of steps in which N can be obtained starting from 0 using addition or subtraction of… Read More »

Given an array of n elements and q range queries (range sum in this article) with no updates, task is to answer these queries with… Read More »

We have already discussed arrays and vectors. In this post, we will discuss advantages of vector over normal array. Advantages of Vector over arrays :… Read More »

C++ STL provides a function that copies the elements from the given range but in reverse order. Below is a simple program to show the… Read More »

vector:: assign() is an STL in C++ which assigns new values to the vector elements by replacing old ones. It can also modify the size… Read More »

Given an array of n integers, both negative and positive, partition them into two different arrays without comparing any element with 0. Examples: Input :… Read More »

Given an integer n, find the largest possible set of non negative integers with bitwise OR equal to n. Examples: Input : n = 5… Read More »

What is Vector of Tuple? A tuple is an object that can hold a number of elements and a vector containing multiple number of such… Read More »

Given a binary tree where each node can have at most two child nodes, the task is to find the Euler tour of the binary… Read More »

There is a tree with N nodes and node 1 is the root node. Each node of the tree can contain fruit or not. Initially,… Read More »

How to apply STL binary_search to vector of pairs(key, value), given that vector is sorted by its first value(key) struct compare in the code contains… Read More »