# Tag Archives: STL

## std::tuple, std::pair | Returning multiple values from a function using Tuple and Pair in C++

There can be some instances where you need to return multiple values (may be of different data types ) while solving a problem. One method… Read More »

## Algorithm Library | C++ Magicians STL Algorithm

For all those who aspire to excel in competitive programming, only having a knowledge about containers of STL is of less use till one is… Read More »

## Common Subtleties in  Vector STLs

Prerequisite – Vector Basics Following are some important points that can save time on little things in an interview or an important coding contest. vector… Read More »

## Design a stack that supports getMin() in O(1) time and O(1) extra space

Question: Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return… Read More »

## Permutations of a given string using STL

A permutation, also called an “arrangement number” or “order”, is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with… 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… Read More »

## Count number of unique Triangles using STL | Set 1 (Using set)

We are given n triangles along with length of their three sides as a,b,c. Now we need to count number of unique triangles out of… 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. Input : Graph as an array of… Read More »

## Functors in C++

Please note that the title is Functors (Not Functions)!! Consider a function that takes only one argument. However, while calling this function we have a… Read More »

## std::transform() in C++ STL (Perform an operation on all elements)

Consider the problem of adding contents of two arrays into a third array. It is given that all arrays are of same size. Following is… Read More »

## Different methods to reverse a string in C/C++

Given a string, write a C/C++ program to reverse it. Write own reverse function by swapping characters: One simple solution is to write our own… Read More »

## Type Inference in C++ (auto and decltype)

Type Inference refers to automatic deduction of the data type of an expression in a programming language. Before C++ 11, each data type needs to… Read More »

## unordered_multiset and its uses

We have discussed about unordered_set in our previous post the problem with unordered_set is that, it is not possible to store duplicate entries in that… Read More »

## std::sort() in C++ STL

We have discussed qsort() in C. C++ STL provides a similar function sort that sorts a vector or array (items with random access). Below is… Read More »

## unordered_multimap and its application

Allows Duplicates: We have discussed about unordered_map in our previous post , but there is a limitation, we can not store duplicates in unordered_map, that… Read More »