C++

transform() Function in C++

Transform function (std::transform()) is present in the C++ STL. It is defined in algorithm header file. This is used to perform an operation on all elements. It applies the given function to a range and stores the result in another range. The transform function works in two modes i.e. Unary [...]

2020-09-23T15:16:50+05:30Categories: Programming|Tags: |

Stack in STL | C++

Stacks are a type of container adaptor, specifically designed to operate in a LIFO context (last-in first-out), where elements are inserted and extracted only from one end of the container. stacks are implemented as containers adaptors, which are classes that use an encapsulated object of a specific container class as its underlying [...]

2019-09-18T23:18:45+05:30Categories: Programming|Tags: |

Queue in STL | C++

The queue container is used to replicate queue in C++, insertion always takes place at the back of the queue and deletion is always performed at the front of the queue. queues are implemented as containers adaptors, which are classes that use an encapsulated object of a specific container class [...]

2019-09-18T23:11:38+05:30Categories: Programming|Tags: |

Unordered Multiset in STL | C++

Unordered multisets are containers that store elements in no particular order, allowing fast retrieval of individual elements based on their value, much like unordered_set containers, but allowing different elements to have equivalent values. In an unordered_multiset, the value of an element is at the same time its key, used to identify it. [...]

2019-09-18T23:01:57+05:30Categories: Programming|Tags: |

Multiset in STL | C++

Multisets are containers that store elements following a specific order, and where multiple elements can have equivalent values. In a multiset, the value of an element also identifies it (the value is itself the key, of type T). The value of the elements in a multiset cannot be modified once [...]

2019-09-18T21:38:52+05:30Categories: Programming|Tags: |

Unordered Set in STL | C++

An unordered_set is implemented using a hash table where keys are hashed into indices of a hash table so that the insertion is always randomized. All operations on the unordered_set takes constant time O(1) on an average which can go up to linear time O(n) in worst case which depends on the internally used hash function, but practically [...]

2019-09-18T21:23:04+05:30Categories: Programming|Tags: |

Set in STL | C++

Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value of the element cannot be modified once it is added to the set, though it is possible to remove and add the modified value of [...]

2019-09-18T21:07:24+05:30Categories: Programming|Tags: |

Unordered Multimap in STL | C++

Unordered multimap is an associative container. Same as unordered map it stores key and value pair. But unordered map doesn’t allow duplicate keys. Here duplicate keys are allowed. Since these are unordered containers, there is no order in the way of storing elements. But this allows duplicates so the elements [...]

2019-09-18T20:30:40+05:30Categories: Programming|Tags: |

STL Containers | C++

The containers library is a collection of templates and algorithms that implement the common data structures that we work with as programmers. A container is an object that stores a collection of elements (i.e. other objects). Each of these containers manages the storage space for their elements and provides access [...]

2019-09-18T20:05:29+05:30Categories: Programming|Tags: |

Multimap in STL | C++

Multi-map is an associative container like map. It internally store elements in key value pair. But unlike map which store only unique keys, multimap can have duplicate keys. Also, it internally keep elements in sorted order of keys. multimap containers are generally slower than unordered_multimap containers to access individual elements by their key, but they [...]

2019-09-17T23:23:27+05:30Categories: Programming|Tags: |
Go to Top