 Hi, this is Christian again. In this second video, if you haven't watched the first one yet, make sure you watch that first, where I went through creating this algorithm here. So again, the idea is to create an algorithm that will perform an in-place operation. Again, the in-place algorithm, it just means that you transform or change data within the same data you received without adding additional spaces. So last time I created this one here using integer, I moved the code into a function call in place temp and I passed it in here. I did not test for different types, but it should work for virtually any type, OK? Because we just basically do a very simple swap. In other words, if I change that to, let's say, if I change that to an object, make an object type, maybe it's a little bit better. Change your object, we'll make that an object, and we can also do the object. And so it still works just fine. As you can see, hopefully, there we go. And if you change this to a string, A here, B, C, P, OK. It should still work for that type. So in this case, any type would be fine, all right? So now let's do a different technique. This time, we're going to use, I'm going to go back to numbers only because it works only for numbers for this case. I will add another one here, 50, OK. And this, I want to use something called the exclusive OR operator. And that is using the carried symbol that looks like this one here, OK? Oops, this one here. So I'm going to turn this off for now. And we're going to create another function down here. It'll be kind of similar to this, but let's create another one here. Add a void in place, void in place, XOR, OK. This is going to be an object, the same data coming in. So this using the in place exclusive OR, you are really doing everything almost purely in place without creating any additional variable like this one down here. We created another variable to store that temp value. But using the exclusive OR, you can just basically swap the data between the two slots without any additional work. Now, exclusive OR will look something like the following. And so to understand a little bit better, I'm going to go and see if I can show my whiteboard and we'll see if this works. OK, let's see here. And I hope you can see my whiteboard here. All right, so here is what we look like. Let me see if I can use my little tablet here. I'm not really good at it. And it's not really, really nice, but let's see if it works. So here is what I'm going to make exclusive OR. Now, exclusive OR, you are dealing with the binary values of numbers. So let's say that I have a list of numbers. We'll put it on the top here, OK? So this is my list of numbers. Oops, it's not very nice. Sorry about that. I was going to put like maybe four numbers for now for us just for the sake of this example. I put 2, 4, 6, and 8, right? Our goal is basically, of course, to transpose this into 8, 6, 4, 2, OK? So the idea is that at this position, is 0 position, 1, 2, and 3, this are the indexes, OK? So we're going to swap 2 and 8. So how do we do this? Now, you know, exclusive OR, you are dealing with the binary numbers of each of these positions. So the binary for 2 is like this. I put 2 here. The binary for 2 is using 4 positions, 0, 0, 1, 0, OK? That's the binary for 2. And the binary for 8 is, I put 8 down here. So it's going to be 1, 0, 0, 0, OK? So we do the exclusive OR. Basically, you do this, and I put an XOR for exclusive OR. Is that, is this like the reverse of the OR? That means that if the two values are the same, then they receive a 0. If they are different, then they receive a 1, OK? So 0 and then here 1. So this new binary number is what? A 10, right? So we got 8, 10 because, you know, 8 plus 4, 0, 2 is 10. So we're going to swap 10 into this position. So now at this point, if you go to the next lot, if I rewrite this again down here like this, sorry for my ugly writing here, this is now 10. And this is still 4, 6, 8, OK? So what I'm going to do is swap this position with the 10. So in this case, I would say something like, yeah, so N of 0 would be 10. The next thing is, I'm going to swap this number over here, OK? So N of 0 is equal to the N of 0 here. So N of 0 and Java use the angle, the care like this. This is a exclusive OR of the, against the last number. So the N of, right? The N, the length, which is in this case, right? Minus 1, for now, or in a 3, right? And then you do that exclusive OR, and you're going to get a 10. You assign 10 into the first lot. And then you do the 8. So same idea. So 8 is now going to do 8 against the 10. So here's 10 already. I'm going to do 8. So let's put 8 down here. 8 is 1, 0, 0, 0. So you do it again, OK? So 0, 0 is, it says 0. 1, 0 is a 1, 0. And it's the same, so it says 0. So now you see it is a 2, right? This is a 2 now. So you put 2 in this lot, OK? So I can cross this out, put a 2 here now. Well, guess what? This 2 is already this 2 here. You can see that already, right? Already transferred that over. So now my end of the third position, it's prettier for now, is equal to the same thing. Exactly the same command put right here. If I do that, I'm going to get 2. And then you do one more time to replace the 10 with what was there before. I mean, the 8, how do you get that back? If you do another round. But this time, so I'm going to do 2 against the 10, right? So here's a 10. Because 10 is right here, 2 is already here. So it'll be a 1, 0, 1, 0. Add them up. You get a 0, a 0, and then 0, a 1. Well, what is that? That is an 8, right? So now end of 0. Again, you put the same code here again. And then you now see that you swap the 8 over. And I just swap my 8 and my 2. So that is the idea of using this exclusive OR operator, very handy in a situation like this. So now let's go back and continue on with our code. This time, we're going to change our code here, write our code, do as before. And for end, I is 0. I will be less than the length of the end by 2, just like down there, right? Let's guess. OK. So this time, we're going to do the exclusive OR. Excuse me. Let's just focus on this one here. So I want to do end of the i-th position. It's equal to end of the i-th position. This carries symbol. And then the last position would be end of the length of the end position minus 1 minus i, right? Don't forget that i. And then we do that. And we assign that to end of the first position, OK? Didn't like something here what I do wrong here. Can I use operator object? OK, so that's a problem, right? Because I've got an object, and its object doesn't like that. So let's go back to before. Just use integer file, OK? Inager, and then we'll put integer here. OK. So we get that done. And then we'll do it again down here. The swap of the end, that length minus 1 minus i. This is the last position. And I'm going to copy this. Exactly same. You can put any order. Doesn't matter here, OK? This can go first. Doesn't matter. It's still the same. And then finally, copy this again. Do one more time. So three swaps, basically. But you notice that I did not create any new additional variables, OK? And if it's correct, then it should have done the swapping for us. So let's take a look and call this function here. Function call here, pass into that. And then save, and let's run and see what happens. And here we go. As you can see, it's working beautifully. I can just show it does work, put some different numbers here, and try again. There we go. They are nicely swapped, OK? So this is usually exclusive for operator.