text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
So once we fix that problem-- if you guys want to switch--
1,884.39
3.11
I start again over here.
1,887.5
1.485
And I have to find the next smallest element.
1,888.985
1.875
And let's see, 8 is pretty big.
1,890.86
1.82
6 is smaller.
1,892.68
0.69
Good.
1,893.37
0.5
7, not smaller.
1,893.87
1.95
But only once I get to the end do I realize, oh, here is the smallest.
1,895.82
3.07
So in short, to find the smallest element
1,898.89
2.56
as you proposed again and again, I have to keep going through the whole list
1,901.45
4.349
because it might be all the way at the end.
1,905.799
1.791
We, humans, have the advantage of just kind
1,907.59
1.49
of looking, sort of taking a step back and saying,
1,909.08
2.19
OK, this is obviously unsorted.
1,911.27
1.44
I know where everything is.
1,912.71
1.17
A computer can only look at one number at a time,
1,913.88
3.05
one element of an array at a time.
1,916.93
1.99
So let's try a fundamentally different approach.
1,918.92
2
If you guys could reset to your original 8 locations.
1,920.92
2.53
Let me propose that we just looked at an algorithm
1,923.45
4.27
that we'll call selection sort.
1,927.72
1.54
Selection sort in so far as you iteratively again and again select
1,929.26
4.24
the next smallest element.
1,933.5
1.63
Let's now do an approach that we'll call bubble sort, which
1,935.13
4.46
has sort of the visual effect of numbers bubbling up over time as follows.
1,939.59
4.277
You know what?
1,943.867
0.583
I'm just going to look, not at the whole list
1,944.45
1.76
because it felt like that was creating a lot of work for me.
1,946.21
2.51
I'm going to look at 2 numbers at a time, 4 and 2.
1,948.72
2.54
Are these in order or out of order?
1,951.26
1.63
Obviously.
1,952.89
1.44
So they're out of order.
1,954.33
1
So you know what?
1,955.33
0.48
I don't care about the rest of the problem.
1,955.81
1.791
Let me just swap you two.
1,957.601
1.619
All right.
1,959.22
0.5
Now, let me take one step.
1,959.72
1.51
Look at 4 and 6.
1,961.23
0.94
In order or out of order?
1,962.17
1.32
In order.
1,963.49
0.53
So I'm going to leave it be.
1,964.02
1.24
6 and 8?
1,965.26
0.86
In order.
1,966.12
0.81
8 and 1?
1,966.93
0.55
Not in order.
1,967.48
0.76
So let me swap that again.
1,968.24
1.555
8 and 3?
1,969.795
1.005
Out of order.
1,970.8
0.57
Let me swap that again.
1,971.37
1.52
8 and 7?
1,972.89
1.219
Out of order.
1,974.109
0.541
Let me swap that again.
1,974.65
1.78
8 and 5?
1,976.43
0.969
Out of order.
1,977.399
0.541
Let me swap that again.
1,977.94
1.69
And now, what has happened?
1,979.63
1.16
Is the list sorted because I fixed all the pairwise mistakes?
1,980.79
5.51
So obviously not.
1,986.3
1.01
But is it better, the list?
1,987.31
1.412
Why is it better?
1,988.722
0.708
Derek.
1,989.43
0.66
AUDIENCE: Because now you have one less element to worry about.
1,990.09
2.02
SPEAKER 1: Yeah, exactly.
1,992.11
1.041
8 bubbled all the way up to the top, if you will.
1,993.151
2.879
So now he is effectively done.
1,996.03
1.83
And frankly, every other number that's smaller
1,997.86
1.98
bubbled one step closer to its position.
1,999.84
2.899
So we've taken one big pass through this to solve at least one of the problems.
2,002.739
3.291
And now maximally, 7 problems remain.
2,006.03
2.58
So let me go back to the end here.
2,008.61
1.86
And let me look at pairwise.
2,010.47
1.31
2 and 4?
2,011.78
0.55
You're good.
2,012.33
0.55
4 and 6?
2,012.88
0.55
You're good.
2,013.43
0.5
6 and 1?
2,013.93
0.9
Let's fix that.
2,014.83
1.47
6 and 3?
2,016.3
0.82
Let's fix that.
2,017.12
1.59
6 and 7?
2,018.71
0.58
We're good.
2,019.29
0.5
7 and 5?
2,019.79
0.73
Let's fix that.
2,020.52
1.35
And now I can ignore number 8 because I know the end of my list is sorted.
2,021.87
3.65
So now, I've improved it slightly.
2,025.52
1.8
7 has bubbled up to where he needs to be.
2,027.32
2.06
I just have 6 problems left to solve at most.
2,029.38
2.22
So now I look again.
2,031.6
0.88
2 and 4?
2,032.48
0.53
You're good.
2,033.01
0.77
1 and 4?
2,033.78
0.78
Let's swap that.
2,034.56
1.01
And notice, 1 is moving closer to the left of the list.
2,035.57
2.93
4 and 3?
2,038.5
0.51
Let's swap.
2,039.01
1.3
4 and 6?
2,040.31
0.6
You're good.
2,040.91
0.5
6 and 5?
2,041.41
0.61
You're not.
2,042.02
1.01
But now I fixed 6.
2,043.03
1.35