Vector vs unordered map

why to use unordered map when we have vector available to use??

unordered map and vector are very different
unordered map is a hashing STL

unordered map provides constant time access to value and search time is also constant
while in vector it takes search time of logn (is sorted data ) else liner (in normal case)

In unordered map you strore data by key value pair, and if you want to search a value you do it by a key.
e.g : map[tushar]= 100

In vector you can not do so.

see this link for unordered map
http://www.cplusplus.com/reference/unordered_map/unordered_map/

see this link for map
http://www.cplusplus.com/reference/vector/vector/

hi if you doubt is resolved please it as resolved or please post in the thread.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.