I input 3 4 1 2 5 in unordered map, but while printing i get 52 1 3 4, ordered gets changed why?
UNORDERED MAP DOUBT
hello @samardeep
its unordered map, it wont ensure any uniform order(order will be random depends on internal hasing algorithm).
if u want ur output to be in particular order(like ascending or descending) then use ordered map.
the order in which i am inserting it should be in the same order ??? like 3 is inserted first so it.begin should point to 3 ???
no it can be in any order.
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.