prestoring and fetching
why hashing?
now, hashing is → prestoring/ fetching
a array of size 13
with initial as 0; it is a hash array
updating with the iteration
code
one imp thing for 10^7 will not go for the array
can we do character hashing?
![Untitled](<https://prod-files-secure.s3.us-west-2.amazonaws.com/94b73934-74f9-494c-9e82-21f4a31e6ebf/66777cb8-658d-485d-ac2a-fdc72e51f587/Untitled.png>)
aperently the formula will be character - ‘a’
then, e-a =4,
vagera vagera
problem 2- code
always prefer arrays
number hashing → stc/collection
stl comes here: vahi ki 10^9 jitna isme nahi aa paye ga
map and unordered map,
arr= 1,2,3,1,3,2
code:
map<long or int,int> mpp;
for
itrate in map:
HashMap
Unordered_map
no perticulat order
worst case: o(n);
first case : take unordered_map → if tle, then go to normal map