is there any differnce between set and unorder set
Stl-unorder set
hello @shashankmaheshwari054
yeah …
a) set is implemented using self balancing bse whereas unordered set is implemented using hash table
b) set keeps ur elements sorted, in unordred set elements are not sorted
c) all operation of set is o(log(n)) , in unordered set it is O(1) average but o(n) in worst case.
unorderset only stores the unique elements??
both the sets stores only unique elements ie they dont store duplicates
which one would be better unorderdset or map in this question
check sbuarray sum with zero
u mean set or unordered set?
use set if u compete in codeforces contests, people hack solutions that use unordered set .
at otherplace use unordered set as worst case dont occur much frequenctly . . . . . .
didnt get ur doubt ?
i want to know that to check subarray sum zero which stl should i use unorderset or map
u can use any of them, upto u.
both have the same timecomplexity i
no …
set has similar complexities as map
unordered set has similar complexities as unordered map
could tell me the time complexities of each
…
…
…
…
…
its also covered in ur stl playlist
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.