CPP Algorithm

CPP facilitates a number of functions that can be applied on a range of elements. Some of these are: Binary search FUNCTION USES binary_search To test if the values in the range exists in a sorted sequence or not. equal_range To get the subrange for the equal elements. lower_bound To get the lower bound element … Read more

Categories CPP

CPP Bitset

CPP provides various bitset functions. Some of these are: FUNCTION USES all() To test whether all bits from bitset are set or not. any() To test whether at least one bit from bitset is set or not. count() To count the number of set bits. flip() To flip all the bit values converting zeros to … Read more

Categories CPP

CPP Multimap

Multimaps in CPP are used to store sorted key-value pair. They are the associative containers. Each key in a Multimap is not necessarily unique. Unlike maps, duplication of keys is allowed in case of multimap. CPP facilitates insertion and deletion of a key in a Multimap but do not allow any modifications, however, values can … Read more

Categories CPP

CPP Map

Maps in CPP are used to store sorted key-value pair. They are the associative containers. Each key in a map is unique. CPP facilitates insertion and deletion of a key in a map but do not allow any modifications, however, values can be modified. Member Functions of a CPP map: Allocator: FUNCTION USES get_allocator To … Read more

Categories CPP

CPP Queue

Queue is a data structure in CPP that works on FIFO (First In First Out) technique, which means that the first inserted element will be deleted first in a queue. Syntax: template<class T, class Container = deque<T> > class queue; Member Types of CPP Queue: MEMBER TYPE USES container_type To specify underlying container type. const_reference … Read more

Categories CPP

CPP Stacks

Stack is a data structure in CPP that works on LIFO (Last In First Out) technique, which means that the last inserted element will be deleted first in a stack.   Syntax: template<class T, class Container = deque<T> > class stack;   T: It is used to represent the type of the element that the … Read more

Categories CPP

CPP Set

Sets in CPP are used to store sorted key. They are the associative containers. Each key in a set is unique. CPP facilitates insertion and deletion of a key in a set but do not allow any modifications. Member Functions of a CPP Set: Allocator: FUNCTION USES get_allocator To return an allocator object to construct … Read more

Categories CPP

CPP List

The function of List is more or less same as CPP vector, however unlike the CPP vectors, CPP list is a contiguous container which supports a bidirectional insertion and deletion operations. In CPP list, elements are accessed sequentially Which results in slow traversal. Syntax 1: list <data_type>  list_name{value1, value2, …….}; Syntax 2: list <data_type>  list_name … Read more

Categories CPP

CPP Deque

Double ended queue or Deque in CPP is used for insertion and deletion of data from both the front end and the back end of a queue. Syntax: deque <object_type> deque_name; CPP Deque Functions FUNCTION USES at() To access the element at position pos. assign() To assign new content to the deque, replacing the old … Read more

Categories CPP

CPP Vector

A vector in CPP is used to implement a dynamic array. Vector in real, is a sequence container class. Here, dynamic array means that the array size automatically resizes itself when appending elements at run time. However, in static array, array size cannot be changed during run time. Syntax: vector <object_type> vector_name; CPP Vector Functions: … Read more

Categories CPP