Vector of Maps in C++ with Examples
Vector in STL: Vector is the same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector elements are placed in contiguous storage so that they can be accessed and traversed using iterators.
Vector of Maps in STL: Vector of maps can be used to design complex and efficient data structures.
Vector of Ordered Map:
vector<map<datatype, datatype> > VM;
Vector of Unordered map:
vector<unordered_map<datatype, datatype> > VUM;
Given a string. The task is to find the frequency of characters up to each index.
Frequency upto position 1 g-1 Frequency upto position 2 e-1 g-1 Frequency upto position 3 e-2 g-1 Frequency upto position 4 e-2 g-1 k-1 Frequency upto position 5 e-2 g-1 k-1 s-1