# Tag Archives: STL

## How to delete elements in C++ STL List ?April 18, 2017

How to insert elements in C++ STL List ? This article covers the deletion aspects in STL list. Using list::erase(): The purpose of this function… Read More »

## Find all pairs (a,b) and (c,d) in array which satisfy ab = cdMarch 29, 2017

Given an array of distinct integers, the task is to find two pairs (a, b) and (c, d) such that ab = cd, where a,… Read More »

## Convert an array to reduced form | Set 2 (Using vector of pairs)March 27, 2017

Given an array with n distinct elements, convert the given array to a form where all elements are in range from 0 to n-1. The… Read More »

## Implementing Iterator pattern of a single Linked ListMarch 9, 2017

STL is one of the pillars of C++. It makes life lot easier, especially when your focus is on problem solving and you don’t want… Read More »

## Size of array after repeated deletion of LISFebruary 23, 2017

Given an array arr[0..n-1] of positive element. The task is to print remaining elements of arr[] after repeated deletion of LIS (of size greater than… Read More »

## Graph implementation using STL for competitive programming | Set 2 (Weighted graph)January 20, 2017

In Set 1, unweighted graph is discussed. In this post, weighted graph representation using STL is discussed. The implementation is for adjacency list representation of… Read More »

## Graph implementation using STL for competitive programming | Set 1 (DFS of Unweighted and Undirected)January 19, 2017

We have introduced Graph basics in Graph and its representations. In this post, a different STL based representation is used that can be helpful to… Read More »

## Sort even-placed elements in increasing and odd-placed in decreasing orderJanuary 11, 2017

We are given an array of n distinct numbers, the task is to sort all even-placed numbers in increasing and odd-place numbers in decreasing order.… Read More »

## Sort an array according to absolute difference with given valueDecember 22, 2016

Given an array of n distinct elements and a number x, arrange array elements according to the absolute difference with x, i. e., element having… Read More »

## Sum of all elements between k1’th and k2’th smallest elementsDecember 21, 2016

Given an array of integers and two numbers k1 and k2. Find sum of all elements between given two k1’th and k2’th smallest elements of… Read More »

## Maximum product of an increasing subsequence of size 3December 17, 2016

Given an array of distinct positive integers, the task is to find the maximum product of increasing subsequence of size 3, i.e., we need to… Read More »

## Count pairs whose products exist in arrayDecember 16, 2016

Given an array, count those pair whose product value is present in array. Examples: Input : arr[] = {6, 2, 4, 12, 5, 3} Output… Read More »

## Minimum delete operations to make all elements of array sameDecember 9, 2016

Given an array of n elements such that elements may repeat. We can delete any number of elements from array. The task is to find… Read More »

## Minimum Cost Path with Left, Right, Bottom and Up moves allowed

Given a two dimensional grid, each cell of which contains integer cost which represents a cost to traverse through that cell, we need to find… Read More »