Hi, everyone.
So in this video, we're going to discuss this topic, itis now suppose you are provided with that,
that you can easily traverse the Liati.
Now, I suppose you have vectors then also you can easily traverse the area using the standard size
function.
You can go to each and every element and you can access the elements.
Now you have a map, so how you will traverse the map.
So basically for traversing the map, for accessing every key value inside the map, for accessing every
element inside the map, we use our database.
So with the help of our we can traverse the maps.
OK, so many enrolled classes have our tutors so better also have our tutors.
We have a list class to list.
A class also has iterators.
Similarly, we have so this is map we have on our road map.
So in order to map also has our database.
Similarly, you have unordered.
And all that said and ordered it, so they also have ideato.
So what is an order said and what is simple said, so downloaded that map and our road map, so they
are very similar.
So what maps those maps?
Turkey, the loopier.
But it will store only keys, it will not only keys, it will not store values, arrest everything the
same, everything will be same.
So this map will take longer time for INCERTITUDE Search.
So this search will take longer time for instability and search.
So this road map, it takes constant time for you to certainly touch this set an hour to start.
It will also take constant time for INCERTITUDE search.
So I would think the same.
It is just that map will develop it and settle to or Leakey's, not values.
Simple.
So all of these map on our road map said said so for our data on all these glasses you need, I do this
for Vector.
It is optional to use iterators to traverse the vector because we also have the standard size function.
OK, so 428 is optional to use.
So if this map is this map is implemented using bisdee, so this set is also implemented using Boudi.
Similarly, in order to map is implemented using hash table.
So an order that is also implemented using hash table.
So everything is very same, everything is very similar between between map and said.
So now let us write the code.
So I already had to file.
Now let us create an unwanted map first, let us take over the map and then we will also see vectors
how we can use our data for vector.
So let's say the string, let's say the keys string and the value is integer and the name of map is
my map.
And now let us push them in place.
So my map of, let's say stringers, ABC.
And let's say the values run, so now let's copy this.
So I have pushed six entries inside my map, so the size of my map is basically six.
Now we want to assess each and every element of my map, so how can we access each and every element?
We will use our database.
So how can we use our database?
And now let's discuss what are our duties.
So basically, we want to traverse our unordered map.
We want to exhaust each and every element of our road map, so as the name suggests on that map, so
that means when you will traverse this and road map so there is no ordering of the elements.
So there is no guarantee which element will come first and which element will come last.
So it is not guaranteed that ABC will come first and ABC will come at last.
So there's no guarantee.
OK, and that means there is no ordering of elements.
So now what will happen?
So basically you have this map, so I don't know how it will store our developer.
Then we have our data so decided I will point to an element and what is an element?
An element is basically a developer.
So our data is basically pointing to a developer.
And if I will do 80 plus, plus, 80 plus, plus means move to the next element.
So next element can be anywhere.
So it will move to the next element.
So when will do it?
So this is a point.
It will move to the next element and we do not know how the map is destroying our element.
So it can be anything.
So the next element can be anything.
We don't know the.
So there is no guarantee in which order the elements will appear.
Now, how to create Knight-Ridder?
So the syntax for creating a narrative is you will write an altered map.
Then you will write Stringer and Bija.
Then you will write a column column and then you will write the Syntex editor and then you will give
the name.
So the name is 80.
So this is the type.
This is the day to day.
And this is basically the name of the variable.
This is the name of the variable.
OK, so I have a function.
So if you will, right, it equals my map.
Dart begins, So I have a function begin.
So this began with the help of this big and function decided, I will point to the first element of
the map.
So this idea will point towards the first element of the map, simple.
And then we will do it plus plus.
So we will move ahead.
So I have a sales function.
So I know, for example, in our case, so there were six 11 percent.
Now what I will do with the help of begin function, I will get to the first element, then I will do
it six times because the size of the map is six and I will print all the key values here.
Not the second option of reversing the map is basically we have a function darte and.
So what I will do when it becomes equal to my stepdad and what will happen so and so and does not mean
this one so and miss the element after last.
So basically, this is and this is not and this is not.
And this is wrong.
This one is end.
So what can I do?
I will start from begin.
I will do it placeless, so I will move ahead and then I will reach my stepdad and I will stop by treating
simple.
And the second option is basically you go to do begin, you will do it plus plus six times because the
size of the map is six and you can print all the elements.
Now, let us write the code, so let us use for loop, you can also use a while loop.
So for now, again, first we have to give the red tape so this is not a tape.
And the name of the variable is IP, and we will go to the beginning to my map that I have begun to
function.
Then.
It is not equal.
Do I have to traverse my map?
They lied, they lied.
It is not close to my and 80 plus plus.
Symbol.
Now, what is Ed?
So basically, what is Ed pointing to?
So you have this Ed idea.
So this ad is basically pointing to appear.
So this is a beard, a gray beard.
I want to ask and I also want to assess the value.
So if I have a beard, how can I first and second element so I can write it out first.
But I have an address.
So this is a pointer.
So if you want to access the first element, you have to write it first.
And similarly, you want to access the value.
So value is basically a second.
So ideato first is basically it every second is basically really simple.
So now let us spend.
Gizzle footprinting, the key idea first IP is basically.
My editor.
So ideato first and now let us also paint disvalue.
So we're printing out the value, I will use it every second.
Now, since this is an Redmap, so there is no ordering of elements, so there is no guarantee which
element will come first and which element will come at last.
So you can compare yourself, Bc5 is coming out first, then ABC for then simple ABC, then one, two
and three.
OK, so there is no ordering.
So now, if instead of using a road map, you will lose map, so in map, this is basically starting.
So let me copy this one.
Now, instead of using an Redmap, if I will use simple map, so simple map means ordered map, so I
have to change the name.
So let's see my map to.
And similarly, this is my map, do not begin my daughter end, and it's basically a local variable,
so there's no need to change the name.
Now, this map is basically ordered map, and that map basically means, if you will remember Bestinvest,
if you will do the traversal.
So in order to basically started.
So basically, I got this map.
This ordered map, it will start dakis.
It will start our kids, so.
This is how it will store their data.
So guys are sorted.
OK, so this map will sort the keys, so I will us inside the mine.
I will drive us in.
So I did manage according to Keys.
OK, now let's see.
OK, so this will be basically Maberly.
So you can see.
The values are sorted, so I am traversing this map, according to Kees.
So what I want to say is so forget about values, so basically maps are sorted according to keys, so
ABCs smaller than ABC1, then ABC two, ABC three ABC for an ABC.
It is not sorted according to values.
So let me demonstrate you.
So, for example.
If this value is, then.
And.
Let me push this one first.
So now what I did here, first I am pushing ABC1, then I am pushing ABC, then ABC, to see what will
happen.
The map will Czartoryski will appear on the basis of this, not on the basis of values.
So let's end our program.
No doubt in first ABC, then ABC one and then ABC two.
So basically the order to map its heart gave a little bit on the basis of KISS and not on the basis
of values.
OK, so Value 10 is coming out first.
So this is a point to remember.
So in map I have developed, so MAP will start on the basis of this map will start on basis of keys
and not on basis of values.
You should remember this one.
Certain bases of keys and not on the basis of values, so similarly, just like in MAP, we also have
items for vectors.
So let's see.
So let us create a vector first.
But often tedious.
And now let us push some values.
So we don't push back, let's say one.
Now, let us push some elements.
So this is two, then three and four and then five.
So basically Vector's has ordering of elements, so there is an order for elements.
So it will traverse.
Director, you will get.
The data in which you inserted the data.
So I pretty.
So this is.
The name of the victim is Vissel Vidauban.
B is not equal to.
So this is a so it is not going to be dark and.
Similarly, 80 plus plus.
So what is happening here?
So for victims, it is basically pointing to an element.
So if you want to access the element, you have to write star, be defense operator, then study it
because it's containing Editress.
So that's why you have to write 80, which accessed the element.
Star idee.
So in our last best.
So see one, two, three, four, five days basically ordering of elements if we make the first willerton.
Now let's test our program.
So basically you will get the values in order, you inserted the values.
OK, so first I'm getting Ben.
OK, so we all know how that works now, apart from divorcing Ed, also have many of use cases.
For example, you can use it later.
For finding an element, whether an element exists or not.
So basically what you can do.
So I have a function find, so I have a function find this fine function will take as input and this
function will return and I did.
So this phone function returns and I do that now, if this idea is basically it goes to my daughter
and.
So that means the element does not exist in the map symbol.
So let me show you.
So if.
My map got find function.
So this fine function will take as input and let the Keys ABC.
Equals equals my map dot and.
So I told you, this fine function will determine our data and function is also returning annotated,
so I'm comparing those to items.
So if ABC is present in my map, then this condition will become false.
So you can write.
Not pleasant.
As you can write, president.
OK, so what I'm doing here is.
So I have inbuilt function, find this fine function will return minute later, and if that data is
basically equal to the and I did this and it means basically this and.
Not the last element after the last element.
So basically, if I'm not able to find A.B.C., what will happen?
It will return me the end point.
And if it is returning me and pointed at Miss ABCDs, not pleasant as it is present, I guess we'll
suppose is present.
So what will happen?
So this fine function will administrator to ABC.
So.
Let's test our program.
So ABC is currently presenting my daughter to present.
So the output is present.
Now, apart from finding.
So what did can also do so let us create an editor, so let us copy this one on Redmap.
Now, let us try to find out.
Editor for ABC.
So what I will do, I will call this function my dart, find ABC.
So this find this is my map, so this fine function will return minute later to ABC.
And then what can do, you can it is so you have a function.
My God, it is now is function takes two things as input.
Either you can give the key or you can also give it later.
So I want to give Ed here 80.
So what is happening here, my lord, find ABC so dysfunctional administrator to ABC and then I am I'm
using it is a function to delete ABC.
So if you will run this program this time, the output will be not present.
Output will be not present.
OK, so let's see.
To the output is not pleasant because we deleted that entry.
So now we have two functions, first function is fine function, the second function is command function
to check whether a key is present or not.
So we have two functions now.
We can use fine function to check whether it gives present or not.
Similarly, we can use current function to check whether it is present or not and similarly what it
is function for function.
Either you can pass the key, it will it is or it can also pass the editor to it is function and it
will delete that entry.
Now one more thing.
What you can do, you can use it is function.
You can give the starting data and you can also give the ending iterator.
So I want to delete.
So this is the starting data and this is the ending data.
So what will happen if you will write this code?
So what entries will be deleted?
So it will delete it.
It will delete it plus one, it will delete it plus two and it will delete 80 plus three.
So 80 plus for this will not be deleted.
This is basically excluded.
OK, so if you write something like this, it is you will give the starting point that my mapped out
begin and if you will give the ending point, which is my map, not end.
So what will happen if you write like this?
It is my map, not begin, comma, my end.
So this is the starting out.
This is the ending I did.
Then what will happen?
Your map will become empty.
So let's test this one, OK.
So basically.
So basically using this thing, using this thing does not make sense for an Redmap, because for an
Redmap, we don't know which one is the next entry because it is not ordering.
So this thing only makes sense for basically ordering other classes.
For example, map, for example, vectors, because there is ordering of elements.
OK, so this thing does not make any sense for an oral element, because I don't know which element
is the next element, how the elements are stored.
So now let's use it is function.
So now let us it is the complete map.
Let's make our map and producer.
What I will do, my daughter is.
So let's come out.
I can give two pointers, so to iterators, so my Mabahith bigon.
Start leading from beginning Twitter and go until my McBratney.
So what will happen?
My map will become empty, so if you will try to find out, ABC now will be not present and this will
not print anything.
The output will be empty map.
So I printing my map that begins with our will be pretty map.
OK, so it will not be indenting because our map is empty.
You can also print my map glasses so you can print.
The size also, so my bra size will be zero.
So I am deleting I'm making my mind up empty so the size will be zero and this court will not print
anything and the output will be not present.
OK, let's see.
So not pleasant.
Then this line of code is not printing anything, then my blog site is zero, so that's how you can
use it function.
So all this function to find function begin to function and function.
It is function.
So all these functions are also present in the upper classes and inside glass and said, OK, so all
these functions are better.
And they're also now one more thing.
So instead of using this vector and I can use I have a keyword auto.
So I told you what is this?
So this is actually a data type.
Now I have a keyword auto.
So what auto keyword will do?
So it will take that type automatically.
It will define the type automatically.
So instead of writing this and then what can I do, I can write 80.
So Auto will automatically make that type, this one.
So what you are writing or writing or do it is my map dot begin.
And this may not begin will return annotator of this type and auto will judge this one or two will sense
this and it will automatically take.
This type.
So instead of.
Using this word, they can do it, you can simply write auto.
So orders is given.
OK, so this will work.
So now let's see.
OK, so I will call this --.
Similarly, you can write auto elsewhere also, for example, instead of vector indictor with can do.
You can simply write auto.
OK, our code is working similarly, you can also do something like this.
Instead of writing and a five words candle called.
What you can do, you can write or towhead.
See the value of these five, so that is the working of auto similarly where they can do.
You can also write like this, although B is basically, let's say A, B, C, D, you can do anything.
OK, let me show you.
So instead of writing.
So instead of writing String See is ABC.
What you can do, you can write auto here, auto.
See ABC and then you can print the value of AC.
OK, ABC, so you can use audio instead of writing this big Syntex, you can write, although, OK,
short one.
So if you have any doubt in this video, you can ask me, OK, I was here in the next one by.