Skip to content

Tag Archives: cpp-list

An Adjacency List is used for representing graphs. Here, for every vertex in the graph, we have a list of all the other vertices which… Read More
In this article, we will discuss how to implement a Stack using list in C++ STL. Stack is a linear data structure which follows. LIFO(Last… 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
Set: Set is a type of associative container which stores elements in a sorted manner. All the elements of a set are unique and can… Read More
In this article, we will discuss the implementation of the lower_bound() and upper_bound() in a list of pairs. lower_bound(): It returns an iterator pointing to… Read More
Prerequisite: List, Stack Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, list has slow traversal, but once a position has… Read More
Forward list Forward list is a sequence container that allows unidirectional sequential access to its data. It contains data of the same type. In STL, it… Read More
The ‘fill’ function assigns the value ‘val’ to all the elements in the range [begin, end), where ‘begin’ is the initial position and ‘end’ is… Read More
Given a List, the task is to delete a range of values from this List using Iterator. Example: Input: list = [10 20 30 40… Read More
Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, list has slow traversal, but once a position has been found, insertion… Read More
Given a List, the task is to remove the last element from this List in C++. Examples: Input: list = [10 20 30 70 80… Read More
list::get_allocator() is an inbuilt in function in C++ STL which is used to get allocator of container list. Syntax: Allocator_type get_allocator() Parameters: This function does… Read More
Given an N-ary tree, print all the levels with odd and even number of nodes in it.  Examples:  For example consider the following tree 1… Read More
Given two arrays A and B of positive integers, elements of array B can be mapped to elements of array A only if both the… Read More