﻿1
00:00:00,470 --> 00:00:04,610
‫So now we're going to do our second intro video for Merge.

2
00:00:04,610 --> 00:00:08,890
‫So in the last video we had two arrays sorted.

3
00:00:08,900 --> 00:00:12,800
‫We combine them into one big sorted array.

4
00:00:13,540 --> 00:00:19,240
‫So now I'm going to put this back and talk about what I left out of the last video.

5
00:00:19,450 --> 00:00:25,300
‫And that is we don't pass the merge function to separate arrays like this.

6
00:00:25,300 --> 00:00:33,130
‫We actually pass it one array that has two sub arrays that are each sorted, but it is one array.

7
00:00:33,550 --> 00:00:40,690
‫And then what we do is we take the sub array on the left and we create a new array where we copy all

8
00:00:40,690 --> 00:00:48,760
‫of these values into the new array, and then we take the array on the right and do the same thing with

9
00:00:48,760 --> 00:00:52,300
‫that into another new array.

10
00:00:52,660 --> 00:01:01,270
‫And when we create those two variables, I and J, it's with these two new arrays that we've created.

11
00:01:01,600 --> 00:01:10,090
‫So when we compare I and J and take the lower value and put it into a new array, we're actually copying

12
00:01:10,090 --> 00:01:12,910
‫it into the original array.

13
00:01:13,180 --> 00:01:19,960
‫So then we compare I and J again, and in this case J is less than, and that's the one that gets copied

14
00:01:19,960 --> 00:01:20,680
‫up.

15
00:01:21,130 --> 00:01:29,860
‫But as we are looping through these, all of these values are being copied into the original array.

16
00:01:30,400 --> 00:01:36,070
‫So now that we've gone over that in the next video, we will code merge.

