Initializing Vector using an Existing Vector in C++ STL
A vector is a type of container which can store objects of similar data type. Vector acts like a dynamic array where we can insert elements and the size of the array increases depending upon the elements inserted....
read more
How to Create a Vector of Arrays in C++?
In C++, an array is a collection of elements of a single type while vectors are dynamic arrays as they can change their size during the insertion and deletion of elements. In this article, we will learn how to create a vector of arrays in C++....
read more
How to Find the Last Element in a Map in C++?
In C++, a map is a container provided by the STL library that stores data in key-value pairs in an ordered or sorted manner. In this article, we will learn how to find the last key-value pair in a Map in C++....
read more
How to Access an Element in Set in C++?
In C++ STL (Standard Template Library), the set container represents a collection of unique, sorted elements. In this article, we will see how to an element in a set in C++ using iterators....
read more
Hike Interview Experience | Set 5
Round I 1.Implement expiry cache system : every page in cache have id and expiry time (TTL of few seconds). After page expires it behaves as free space and can be used for new pages/replacement. Had a long discussion on everything....
read more
Kruskal’s Minimum Spanning Tree using STL in C++
Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal’s algorithm....
read more
How to Check if Map Contains a Specific Key in C++?
In C++, std::map is a container provided by the Standard Template Library (STL) that stores elements in key-value pairs, where the keys are sorted. In this article, we will learn how to find whether an element exists in std::map in C++....
read more
forward_list::cbefore_begin() in C++ STL
forward_list::cbefore_begin() is an inbuilt function in CPP STL which returns a constant random access iterator which points to the position before the first element of the forward_list. The iterator obtained by this function can be used to iterate in the container but cannot be used to modify the content of the object to which it is pointing, even if the object itself is not constant....
read more
How to Extract a Subvector from a Vector in C++?
In C++, vectors are dynamic arrays that can grow and reduce in size as per requirements. In this article, we will learn how to extract a subvector from a vector in C++....
read more
multimap::cbegin() and multimap::cend() in C++ STL
...
read more
Iterator Invalidation in C++
When the container to which an Iterator points changes shape internally, i.e. when elements are moved from one position to another, and the initial iterator still points to the old invalid location, then it is called Iterator invalidation. One should be careful while using iterators in C++. When we iterate over our container using iterators then it may happen that the iterator gets invalidated. This may be due to change in the shape and size of the container while iterating....
read more
Why Rand() function Always give the Same Value ?
Have you ever wondered why the rand() function always gives the same values each time we compile and run our code? well in this post we are going to discuss this phenomenon in brief....
read more