Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,270 --> 00:00:01,630
What is going on, guys?
2
00:00:01,660 --> 00:00:04,140
And thank you so much for getting this far.
3
00:00:04,500 --> 00:00:10,650
You're doing a great job and I can guess that you will, if not already, see meaningful results in
4
00:00:10,650 --> 00:00:11,280
this story.
5
00:00:11,280 --> 00:00:18,570
All I want to talk about a situation where we have these two variables, A and B, and each of these
6
00:00:18,570 --> 00:00:20,850
variables has some value within.
7
00:00:21,000 --> 00:00:21,480
All right.
8
00:00:21,660 --> 00:00:25,710
And for some reason, we have to swap between these two values.
9
00:00:25,860 --> 00:00:33,450
So, for example, at the beginning, we have some box A with a value of ten and a box B with a value
10
00:00:33,450 --> 00:00:34,130
of twenty.
11
00:00:34,320 --> 00:00:38,700
And what we need to do is just to exchange the values within these boxes.
12
00:00:39,000 --> 00:00:44,520
So we at first we had a value of 10 in box A and a value of 20 in box B.
13
00:00:44,700 --> 00:00:51,810
Then after the exchange, there will be a value of 20 in Box A and the value of Tamlin Box B, just
14
00:00:51,810 --> 00:00:53,880
as we can see it in these demonstration.
15
00:00:53,970 --> 00:01:00,180
And basically, you can think of this situation of swapping between the values, the content of two
16
00:01:00,180 --> 00:01:05,220
different boxes as just two boxes with this, some pairs of shoes.
17
00:01:05,220 --> 00:01:09,060
One box has Manchus and the other box has woman's shoes.
18
00:01:09,210 --> 00:01:16,020
So, for example, in box A, we have 10 man shoes, and in box B, we have 20 woman shoes.
19
00:01:16,200 --> 00:01:22,230
But it turns out that box say that should contain woman shoes, basically contains men's shoes.
20
00:01:22,410 --> 00:01:27,630
And that's why we need to replace all the shoes from box, say, with all the shoes from Box B..
21
00:01:27,810 --> 00:01:28,170
Right.
22
00:01:28,350 --> 00:01:33,150
So what would be the trivial way they are to you would solve these kind of task?
23
00:01:33,270 --> 00:01:40,590
You can't just simply take and pour what is in one boxing through the second box and vice versa simultaneously.
24
00:01:40,740 --> 00:01:45,300
Because in this case, there will be just a mix of all the shoes in every box.
25
00:01:45,300 --> 00:01:47,280
And that's not what we want.
26
00:01:47,490 --> 00:01:54,090
What we want is probably to get another box and call these box temp and these box will be used to assist
27
00:01:54,090 --> 00:01:55,950
in these six changing process.
28
00:01:56,160 --> 00:02:02,810
So first of all, we'll take the value of box A, which is 10 and just put it inside of box temp venerable,
29
00:02:02,820 --> 00:02:09,020
take the value of 20, all the shoes from Box B and put them inside of box A.
30
00:02:09,180 --> 00:02:16,830
And finally, we will take all the shoes, all the value itself of 10 from box temp and put these value
31
00:02:16,830 --> 00:02:18,430
inside of box B.
32
00:02:18,600 --> 00:02:24,660
And now the exchange and process between these two boxes, A and B, we can say that it's complete.
33
00:02:24,840 --> 00:02:32,040
So basically you can see that the value of ten, which was previously in box A, is now at Box B and
34
00:02:32,040 --> 00:02:37,430
the value of twenty, which was at box B, is now at box A four.
35
00:02:37,950 --> 00:02:38,490
All right.
36
00:02:38,520 --> 00:02:39,630
Very well, guys.
37
00:02:39,660 --> 00:02:44,100
That's was kind of rough explanation using a real life situation.
38
00:02:44,480 --> 00:02:48,480
And now what I want us to do is to be more close to the programming world.
39
00:02:48,630 --> 00:02:54,960
I want us to write a simple code, a simple program that will use these swap thing in our programming
40
00:02:54,960 --> 00:03:00,210
language so that you will be able to take your skills even one step further.
41
00:03:00,360 --> 00:03:07,260
So I hope this topic is clear for you and that you are ready to move onto the next video for a swap
42
00:03:07,530 --> 00:03:09,780
in your programming language.
43
00:03:09,960 --> 00:03:10,740
I'll see you there.
4403
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.