Hey, guys, what's up?
So we have covered domestic operators, relational operators, logical operators in this video.
We will cover bitwise operators.
OK, so what are bitwise operators?
So bitwise operators.
Works on bits.
So first of all, we are having bitwise and operate at.
So zero and zero is zero zero.
And one is zero one and zero is zero one and one is one.
So this is bitwise and for example, you want to find Si out five, bitwise and three.
So do my output.
OK.
So what is the bi needed presentation of five one zero one?
What is a binary presentation of three.
Zero one one.
OK.
And we have to take bitwise and.
So one one is one zero one zero one zero is zero.
OK, so this is my answer.
Now, convert this binding number into decimal number, which is one.
OK, so it's awkward.
Will be when.
OK, so let's see.
And define Verlinden.
OK, so let's name this file as.
Bitwise.
Not CBB.
You're done zero.
Okay, so we have seen bitwise and see out five and three.
So let's see.
See out.
Five Broadways and three.
OK, so what should be my output?
So let's get a net.
Some output is coming out to be one they have already seen here.
When we do five bitwise entry, my output is one.
So let's see one more example.
So please see out.
For entry, let's say, for bitwise and.
When?
So, Hmoud, produce coming out to be zero.
Way.
So.
We have to calculate for and when.
So what does that binary representation of four?
One zero zero.
What is a binary presentation of one zero zero one big?
And so zero, then zero and then zero converting to decimal zero.
OK.
So Budweiser bitwise and it's clear.
So now we are having bitwise or so it says, zero and zero is zero, sorry, zero or zero or.
Zero.
One as one.
One auto zero as one.
One odd one.
This one.
Okay, for example, see out.
Five or three.
So binary presentation of five is one zero one, binary presentation of three is zero one one.
And we have to take bitwise or so.
One.
Again.
One.
Again, one cannot in two decimal, which is seven.
OK, so its output is seven.
Similarly, let's see.
One more example.
See out.
Let's say three or seven.
So it is a binary presentation of three zero one one.
What is a binary presentation of seven?
When when when we have a big they're bitwise or so.
When, when?
When.
So the output is coming out to be seven.
OK, so let's let's see.
See out.
Five or three.
And vandeven, more value, which is three or seven.
And let's come commander doubt.
So our first answer should be seven.
And second answer should also be seven.
OK, so seven and seven.
So this is Broadways odd.
OK, so let's see some more bitwise operators.
So our next Broadways operator is guard negation not.
So not not means flip all the bits, flip all bits, so negation of five will be, first of all.
Right.
Five, which is one zero one and flip all the bits.
So negation of five equals zero one and zero.
OK.
So what will my output, if I print, see out negation of five?
So what will be my output?
Lenzi.
So first of all, it's come under doubt.
Now we have to bring negation of faith.
So we'll see out.
Negation of faith.
So any guesses where to leave my output?
You can post a video if you want time.
So my awkwardness coming out to be minus six.
Now, let's see why it is coming out to be minus six.
So integer is of four bytes, 32 bits.
So this first debate is called signboard.
And this is Main Édouard 31.
It's.
So we're dealing with a binary representation of life since five is a positive number sign but will
be zero.
And here one zero one and the rest, all of the bits will be zero zero zero zero.
OK, what is negation of life, negation of five is flip all the bits.
So this bit will become one.
Similarly, when, when, when.
Da da da da da.
When, when.
When, when, when.
And here.
Zero.
One and zero.
So this is negation of five.
OK, so this value as equals two minus six.
But how does that lucas' my NSX?
Let's prove it.
So first it is one that means my number is negative.
And for finding magnitude says the number is negative for finding magnitude.
What do I do?
I will find Thuuz compliment, which is once compliment plus one.
So once compliment of this number will be zero zero zero zero zero zero zero zero zero one zero one.
And we have to add one.
So plus one.
So one plus one is then when ghetty when one and all these birds will be zero.
OK.
So convert this number into decimal number, which is four plus two equals six.
So magnitude is six and my number is negative.
So this number is minus six.
And that's why minus six is getting printed.
OK.
You can try one one example, for example, see out negation of one.
So one is simply the first bit will be zero since the number is positive.
And here I am having just one rest.
All bets will be zero zero zero zero zero.
So negation means flip all the bits.
So when.
When, when.
And this will be zero.
So what is this value since the first murders when the number is going out?
The number is negative.
And we're finding magnitude.
We will take two's compliment, which is one compliment plus one.
So zero zero zero zero.
And here will be one and one.
So zero zero zero zero is one.
Plus one is ten.
So one carry one plus zero is one.
So this is my magnitude.
If you convert this number into decimal number, this will be two.
OK, so negation of one will be minus two.
Let's see.
CEO, negation of one.
So we'll see, I see out.
Negation of when?
And Nerd's commended out.
So what, illume output?
So my report is coming out to be minus two.
You can see here.
I would output was also minus two.
OK.
It's come under doubt also.
Now let's see some more bitwise operators.
So we'll just talk about bitwise Zord.
So a zero.
OK, so this is bitwise Zord.
If both the bits are the same, my output is zero.
If the bits are different, my output is one.
OK, so if birds seem mild, Prada's zero, if Brits are different.
Mild, put this one simple.
So let's sprint CE out.
Five or three.
So that's a binary presentation of five.
One zero one.
What is that binary presentation of three.
Zero one one.
And we have today can be gleiser so birdzell seem zero which are different when bits are different.
One.
So this will be my output.
And this is it.
Close to four plus two six.
OK, so let's print.
So see out.
Five, CSAR three.
So now it will be six.
OK, so that would produce six.
Let's take one more example.
See out five Zord, zero in length and one more see out five, Zord five.
OK, so let's run it.
So, I mean, output is five and zero, Myrto, so let's see.
So when I'm doing.
Five zero zero.
So what is the binary representation of five one zero one?
What is a binary presentation of zero zero zero zero bits are different.
When Batarseh zero bits are different.
One.
So you can see one zero one one zero one.
So output is same.
That's why five is getting printed here.
Now, let us talk about this five sort of five.
So five is.
And we have to take zone.
So Brittelle seems zero, but so seems it all itself.
Seems, you know, some outproduce coming out of easy launderettes way.
Zero is getting printed here.
OK.
So with the help of these two example, we have reached an important result.
And what is that reserved.
So my dessert is.
Let's say is any number.
So a czar A will always be zero and a czar zero will be a always.
OK.
So with the help of these two examples, five zero five was zero and five or zero is five.
These two itemise gender drizzles.
Also Zora's associate, too.
For example, if you really do, please, or five whose are three.
So three and three, we cancel our teacher that my.
I will be five.
OK, so this is an important reserve.
So these results are very important.
Right.
If you take two numbers and CSAR them, Margaret will be zero.
And if you take Zschau off any number with zero, my output will be that number only and Zora's associate
to.
If you do something like twos or fives or threes or two or five or three.
So what will be my output?
So five and five will cancel out each other.
Two and two will cancel out each other.
Three and three will cancel out each other's.
Wildwood will visit.
OK, simple.
You can Testudo and so.
For example, she yelled.
Those are three CSAR five.
These are three.
These are five, so mild.
What should we do?
Okay, so let's see.
So Margaret is coming out to me, too, because this tree even cancel history, this wife will cancel
this five.
OK.
Now where we can use this property.
So suppose you are given two one plus one nos.
OK, so you're arguing, given two unpleasant numbers in which each number is getting twice except.
One number, so out of two in lesser numbers, each number is auguring place except one number.
And our task is to find that number.
There it is, all getting on Levens.
For example, the numbers are my input is, let's say one five, one two five.
OK.
So, for example, this is my input.
So all things should be to my eyes.
I should be doing.
So what will I do?
I will resort all of them.
OK.
So when's or five is are ones or twos or five.
So five and five we cancel out each other one and when we cancel out each other and my output will be
two.
OK.
So with the help of Zord we can solve this problem very easily.
OK.
So let us talk about next to Bitwise Operator, which is left shift.
Left shift.
OK.
For example, where do I live my output?
If I rent to left, shift one.
So two left, shift one.
So it is a binary presentation of two.
One and zero and left here to one means.
Shift all the bit towards left and add zero.
OK, we have to shift.
So here I am, size zero zero zero.
So we have to shift all the bits towards left.
And here I will enter.
I will give input zero.
So what do Lim output?
Zero zero zero zero one zero and zero.
So this will be my output.
And what does this number.
This number is for output will be four.
Okay.
Similarly, for example, if I try and do see out, if I try and print, see out one left, shift three.
So we're dillema output.
So first of all, right, one, which is zero zero zero zero zero one.
And we have two left shift this number three times.
So for the first time, it will become zero zero zero zero one and zero.
Now do second time.
So zero zero zero one zero zero.
And we have to do one more time.
So, again, left shift.
So zero zero one zero zero and zero.
So what does this number.
So when to 48, so this number is eight.
OK, so this number is eight.
So what is the formula?
So formula is very simple.
X lurve shift.
Why is it goes to X multiply due to the power.
Y.
OK.
So Ford left shift when it was eight.
Similarly.
Two left shaft two will also be eight when left, shaft one will be two when life shift two will be
for.
When left, shift three will be eight and so on.
OK.
OK, so let us print some of these values.
So commented out.
So let's say see out when Levchin at 3:00.
So maladroit should be it.
So let's it.
So our bodies coming out to be it.
OK.
So Love Church is very easy.
You just have to remember this.
Phumla just ex left church.
Why, as it goes through so much to went through to the ballot.
Why?
So we have left shift.
That means we are also having red shift.
For example.
Where does the value of three.
Right.
Shift one.
So we're Destry.
It is zero zero zero zero.
And here I am having one.
And one.
So we have to.
Right.
Shift it by one.
OK, so right.
Shifted.
We will add zero from here.
So right shift.
So when we will do right shifting.
This one will be discarded.
OK, so finally, this will be my number.
Zero zero zero, Antawn, zero and one.
So this will be my number.
And this number equates to one.
OK.
Similarly, if you want to do, for example, 8:00 at night shift, too.
So it is a representation of it.
So zero one zero zero and zero.
So this is it.
I have to check this number eight two times.
So.
For the first time.
And as you know, from here.
So this zero will be discarded.
So it will become zero zero one zero zero.
Now we have to do it one more time again.
So this is it'll be discarded and it will become zero zero zero one and zero.
So this will be my output, which is.
So similarly, we are having just like we have left your formula.
We also have Richard Phumla.
So x ray shift, why is it close to X upon to the power.
Right.
You can verify it.
For example, three left shift one equals three upon two to the power one, which is one point one.
But in BGT upon and BIJA will be an integer.
Some output will be one.
OK.
Similarly, it Tradeshift, too.
OK, so eight, right shift two equals eight upon two to the power two, which is eight upon four,
which is two.
OK.
So two is so too is here.
OK.
So.
X left shift, why is X interpretative our way and x ray shift away?
Is X upon to do the power Y?
And similarly you have to learn that Zord Farmelo so that any number taken a number Zord with that number
will be zero and any number is always zero will be that number only.
And similarly, you have to learn zero and zero zero zero and one is zero one zero is zero one and one
is one.
Similarly, zero or zero is zero zero or one on one or zero one or one.
So this is one, one and one.
And we know negation means flip.
All the bits flip.
All bets.
And for dessert or.
If Mutassim zero, if bedside defend when.
So if Bertel same, my output will be zero if rates are different.
My output will be when.
OK.
So you might be thinking where we will use all these bitwise operators.
So in this way, do I am not covering that because bitwise operator question will not be alone.
It will come with, for example, Eddie, if it is vitally for loop and so on.
OK.
So when we talk about these topics like it is, if as for low while loop and other concepts, then we
will cover questions on better masking.
So this is actually called a bit of masking.
OK, so when we will cover all this topics, then they will cover question on big time asking, which
is very, very important.
OK.
Thank you.