﻿1
00:00:00,480 --> 00:00:08,760
‫So Merge Sort is going to be our first sorting algorithm that uses recursion and it leverages the idea

2
00:00:08,760 --> 00:00:13,560
‫that if you have two sorted arrays like this, these are two sorted arrays.

3
00:00:14,130 --> 00:00:18,060
‫Combining two sorted arrays is fairly easy.

4
00:00:18,390 --> 00:00:25,740
‫So what merge sort does is this let's mix this up like this and move this to the top of the screen so

5
00:00:25,740 --> 00:00:26,790
‫we have more room.

6
00:00:27,500 --> 00:00:32,060
‫It will take this array and it will cut it in half.

7
00:00:33,040 --> 00:00:35,230
‫And then it will cut it in half again.

8
00:00:35,830 --> 00:00:40,570
‫And then it'll keep doing this until we have single item arrays.

9
00:00:41,330 --> 00:00:46,580
‫Because a single item array is by definition sorted.

10
00:00:47,740 --> 00:00:51,130
‫Then what we can do is take two of these.

11
00:00:52,080 --> 00:00:58,110
‫And combine them into one larger sorted array.

12
00:00:58,650 --> 00:01:03,450
‫And then we continue doing this all the way across like this.

13
00:01:04,020 --> 00:01:06,480
‫Then we'll take these two arrays.

14
00:01:07,480 --> 00:01:11,410
‫And combine them and then we'll combine those two.

15
00:01:11,830 --> 00:01:19,600
‫Now we can take these two sorted arrays and make one big sorted array out of these.

16
00:01:20,960 --> 00:01:26,600
‫When you first look at this, you think, wow, that looks really inefficient to break all of this down

17
00:01:26,600 --> 00:01:28,430
‫into single item arrays.

18
00:01:29,400 --> 00:01:33,810
‫But it is actually an incredibly efficient sorting algorithm.

19
00:01:34,290 --> 00:01:37,980
‫It's as efficient as you can make a sorting algorithm, actually.

20
00:01:39,380 --> 00:01:41,570
‫So that is our quick overview.

21
00:01:42,670 --> 00:01:43,720
‫Of merge sort.

