WEBVTT - Rerun: What is an algorithm?

0:00:04.400 --> 0:00:07.800
<v Speaker 1>Welcome to tech Stuff, a production from I Heart Radio.

0:00:11.880 --> 0:00:14.200
<v Speaker 1>Hey there, and welcome to tech Stuff. I'm your host,

0:00:14.320 --> 0:00:16.760
<v Speaker 1>Jonathan Strickland. I'm an executive producer with I Heart Radio.

0:00:16.840 --> 0:00:19.600
<v Speaker 1>And how the tech are you. I'm not doing so

0:00:19.640 --> 0:00:22.599
<v Speaker 1>great myself right now. I'm running a low fever. I'm

0:00:22.600 --> 0:00:24.919
<v Speaker 1>hoping that I just have like a stomach bug or

0:00:24.960 --> 0:00:27.320
<v Speaker 1>something and that it's not a second case of COVID,

0:00:27.360 --> 0:00:29.960
<v Speaker 1>because I don't want to be that guy. Uh. And

0:00:30.160 --> 0:00:32.080
<v Speaker 1>that's a good reminder that if you are in an

0:00:32.120 --> 0:00:35.599
<v Speaker 1>area where the COVID numbers have not really slacked off,

0:00:36.320 --> 0:00:38.280
<v Speaker 1>still a good idea to wear a mask, you know,

0:00:38.360 --> 0:00:42.520
<v Speaker 1>limit your exposure to other folks. Seriously, this is no fun.

0:00:42.600 --> 0:00:43.919
<v Speaker 1>You don't want to go through it if you can

0:00:43.960 --> 0:00:47.080
<v Speaker 1>avoid it. So yeah, just you know, I care about

0:00:47.080 --> 0:00:50.760
<v Speaker 1>you guys, so take care of yourself. Also, you know

0:00:51.280 --> 0:00:53.640
<v Speaker 1>that means that I'm not really able to write a

0:00:53.640 --> 0:00:56.640
<v Speaker 1>new episode because I can't read good when I got

0:00:56.640 --> 0:00:59.360
<v Speaker 1>a fever. So we're gonna have a little bit of

0:00:59.360 --> 0:01:01.680
<v Speaker 1>a rerun. I apologize for that. I wish I could

0:01:01.720 --> 0:01:04.480
<v Speaker 1>avoid it, I really do. But I also feel like

0:01:04.480 --> 0:01:07.080
<v Speaker 1>this is an episode that is timeless. It's one that

0:01:07.240 --> 0:01:10.240
<v Speaker 1>is important. It's called what Is an Algorithm? Which originally

0:01:10.280 --> 0:01:13.759
<v Speaker 1>published last year on July twenty one, And the reason

0:01:13.760 --> 0:01:16.280
<v Speaker 1>why I think it's important is that a lot of

0:01:16.280 --> 0:01:20.280
<v Speaker 1>people know the word algorithm, but they don't have a

0:01:20.280 --> 0:01:23.000
<v Speaker 1>deeper appreciation of what that actually means. We almost just

0:01:23.080 --> 0:01:26.400
<v Speaker 1>use it as a placeholder. It might as well be magic, right.

0:01:26.680 --> 0:01:29.800
<v Speaker 1>The Facebook algorithm determines what you see and what you

0:01:29.880 --> 0:01:34.160
<v Speaker 1>don't see, but that doesn't really explain what an algorithm is.

0:01:34.280 --> 0:01:37.920
<v Speaker 1>So I hope that you find this episode interesting and

0:01:38.240 --> 0:01:41.520
<v Speaker 1>if you would like to leave a suggestion for an

0:01:41.520 --> 0:01:43.440
<v Speaker 1>episode topic for me in the future. There are a

0:01:43.440 --> 0:01:45.280
<v Speaker 1>couple different ways of doing it. One is you can

0:01:45.280 --> 0:01:48.360
<v Speaker 1>go over to the I Heart Radio podcast app, which

0:01:48.400 --> 0:01:50.680
<v Speaker 1>is free. You can just navigate over to the tech

0:01:50.720 --> 0:01:54.320
<v Speaker 1>stuff page and there is a little microphone icon which

0:01:54.360 --> 0:01:56.520
<v Speaker 1>allows you to leave a talk back message up to

0:01:56.720 --> 0:01:59.200
<v Speaker 1>thirty seconds in length, so you can always leave me

0:01:59.240 --> 0:02:01.800
<v Speaker 1>a message if you like. You can indicate if I

0:02:01.840 --> 0:02:05.000
<v Speaker 1>could use the audio in an upcoming episode, which would

0:02:05.040 --> 0:02:06.840
<v Speaker 1>be a lot of fun. But I'm not gonna just

0:02:06.880 --> 0:02:09.240
<v Speaker 1>assume that you're cool with that. You'll have to tell me.

0:02:09.880 --> 0:02:11.839
<v Speaker 1>And um, A lot of people have been doing that.

0:02:11.919 --> 0:02:14.440
<v Speaker 1>They've been leaving messages. It's been great. You've all been

0:02:14.560 --> 0:02:18.040
<v Speaker 1>so kind and so enthusiastic, and I love it. Keep

0:02:18.120 --> 0:02:20.560
<v Speaker 1>them coming. Also, if you don't want to use the app,

0:02:20.600 --> 0:02:22.679
<v Speaker 1>I totally get it. You can always leave me a

0:02:22.720 --> 0:02:24.880
<v Speaker 1>message on Twitter. The handle for the show is tech

0:02:24.960 --> 0:02:28.600
<v Speaker 1>Stuff hs W. Now let's get to this episode that

0:02:28.639 --> 0:02:32.160
<v Speaker 1>originally published July twenty one, two thousand twenty one. What

0:02:32.560 --> 0:02:39.560
<v Speaker 1>is an algorithm? I frequently speak about algorithms on the show.

0:02:39.639 --> 0:02:42.880
<v Speaker 1>I talked about them all the time, about Facebook's algorithm

0:02:43.000 --> 0:02:47.760
<v Speaker 1>or YouTube's algorithm. We talk about search algorithms and recommendation

0:02:47.840 --> 0:02:51.840
<v Speaker 1>algorithms and tons of others. But I haven't really spent

0:02:52.040 --> 0:02:55.800
<v Speaker 1>a ton of time talking about what algorithms actually are.

0:02:56.240 --> 0:03:01.000
<v Speaker 1>Like it kind of become shorthand for do not look

0:03:01.040 --> 0:03:03.760
<v Speaker 1>behind the curtain, right, It doesn't really help you if

0:03:03.760 --> 0:03:07.000
<v Speaker 1>you don't know more about it. Uh. I might go

0:03:07.120 --> 0:03:08.960
<v Speaker 1>as far as to say it's a set of rules

0:03:09.040 --> 0:03:12.240
<v Speaker 1>or instructions to carry out a task, but that's pretty

0:03:12.280 --> 0:03:15.720
<v Speaker 1>reductive and it doesn't really help you understand what algorithms

0:03:15.760 --> 0:03:18.800
<v Speaker 1>actually do. So today I thought we'd talk a little

0:03:18.800 --> 0:03:21.960
<v Speaker 1>bit about algorithms and what they do in general, and

0:03:22.000 --> 0:03:25.160
<v Speaker 1>then maybe chat about a few famous examples and some fun,

0:03:25.280 --> 0:03:29.560
<v Speaker 1>little quirky stuff. So before I dive into this, we

0:03:29.680 --> 0:03:34.320
<v Speaker 1>do need to establish a few things, and arguably the

0:03:34.360 --> 0:03:37.360
<v Speaker 1>most important of those things is that I am not

0:03:37.440 --> 0:03:41.840
<v Speaker 1>a mathematician. I am not a computer scientist. I'm a

0:03:41.840 --> 0:03:46.000
<v Speaker 1>guy who loves tech, and I'm decent at research, and

0:03:46.120 --> 0:03:50.000
<v Speaker 1>I do my best to communicate topics in an informative

0:03:50.160 --> 0:03:53.160
<v Speaker 1>and you know, on a good day and entertaining way.

0:03:53.600 --> 0:03:56.560
<v Speaker 1>So with that in mind, I fully admit that this

0:03:56.640 --> 0:04:00.720
<v Speaker 1>is a subject that is outside of my narrow expertise,

0:04:01.200 --> 0:04:04.360
<v Speaker 1>and so my descriptions and explanations will be from a

0:04:04.480 --> 0:04:08.480
<v Speaker 1>very high level. Uh. And you might even be able

0:04:08.520 --> 0:04:11.400
<v Speaker 1>to get something like this just by glancing at a

0:04:11.480 --> 0:04:18.039
<v Speaker 1>pamphlet that's about a computer science introductory course. So for

0:04:18.120 --> 0:04:19.719
<v Speaker 1>all you folks out there who are deep in the

0:04:19.720 --> 0:04:23.320
<v Speaker 1>computer sciences, this is going to be like a children's

0:04:23.440 --> 0:04:27.320
<v Speaker 1>story book for you, possibly one where you don't like

0:04:27.400 --> 0:04:31.479
<v Speaker 1>de illustrations very much. Another thing that I need to

0:04:31.600 --> 0:04:35.960
<v Speaker 1>establish is that algorithm itself is a very broad term,

0:04:36.720 --> 0:04:39.359
<v Speaker 1>you know, in that sense, it's kind of like the

0:04:39.400 --> 0:04:44.440
<v Speaker 1>word program or app or software, and that these words

0:04:44.520 --> 0:04:49.000
<v Speaker 1>are categories that can have a wide variety of specific instances.

0:04:49.279 --> 0:04:52.360
<v Speaker 1>For example, let's just take a look at software. If

0:04:52.360 --> 0:04:55.640
<v Speaker 1>I'm talking about software, I could be talking about a

0:04:55.760 --> 0:05:00.120
<v Speaker 1>very simple program that serves as a basic calculator that

0:05:00.200 --> 0:05:04.680
<v Speaker 1>can add and subtract and divide and multiply. That could

0:05:04.760 --> 0:05:06.960
<v Speaker 1>be a piece of software, be a very simple one.

0:05:07.640 --> 0:05:10.040
<v Speaker 1>Or I might talk about something a little more complicated,

0:05:10.120 --> 0:05:13.960
<v Speaker 1>like a word processing program. Or I could talk about

0:05:14.040 --> 0:05:18.960
<v Speaker 1>an advanced three D shooter video game, or an incredibly

0:05:19.080 --> 0:05:23.800
<v Speaker 1>complicated computer simulation program, or anything in between. All of

0:05:23.839 --> 0:05:27.280
<v Speaker 1>those could fall into the realm of software well. Algorithms

0:05:27.720 --> 0:05:32.680
<v Speaker 1>similarly come in a wide variety of functions and complexity.

0:05:32.720 --> 0:05:35.800
<v Speaker 1>There are some that are elegant in their simplicity, and

0:05:35.839 --> 0:05:38.839
<v Speaker 1>there are some that when I look at them written

0:05:38.839 --> 0:05:46.160
<v Speaker 1>out in in what is clearly well defined terminology, uh,

0:05:46.240 --> 0:05:49.040
<v Speaker 1>I'm just left wondering what the heck it is I

0:05:49.080 --> 0:05:51.640
<v Speaker 1>just saw. They might as well be hieroglyphics to me.

0:05:51.680 --> 0:05:54.760
<v Speaker 1>In other words, but let's start off by talking about

0:05:54.839 --> 0:06:00.599
<v Speaker 1>the word algorithm itself. Now, unlike a lot of words

0:06:01.040 --> 0:06:05.599
<v Speaker 1>that we use specifically in English, algorithm does not have

0:06:05.760 --> 0:06:10.440
<v Speaker 1>its roots in Latin vocabulary. There are words in Latin

0:06:10.520 --> 0:06:13.200
<v Speaker 1>that are like al gore and things like that, but

0:06:13.320 --> 0:06:17.719
<v Speaker 1>that's not where algorithm comes from. Instead, it's a Latinized

0:06:18.040 --> 0:06:23.840
<v Speaker 1>version of an Arabic name. Algorithm comes from algorithmic, which

0:06:23.880 --> 0:06:26.640
<v Speaker 1>is the name that Latin scholars gave to a brilliant

0:06:26.880 --> 0:06:31.359
<v Speaker 1>man named al Ka Ritzmy and my apologies for the

0:06:31.440 --> 0:06:35.680
<v Speaker 1>butchering of the pronunciation of that name. No disrespect is intended.

0:06:36.400 --> 0:06:43.760
<v Speaker 1>It's merely American ignorance anyway. This particular mathematician philosophers scholar

0:06:44.360 --> 0:06:48.159
<v Speaker 1>served as a very important astronomer and librarian in Baghdad

0:06:48.520 --> 0:06:53.360
<v Speaker 1>in the ninth century. His work in mathematics was truly foundational,

0:06:53.880 --> 0:06:57.600
<v Speaker 1>so much so that we get the word algebra from

0:06:57.640 --> 0:07:01.680
<v Speaker 1>a work that he published. He treated algebra as a

0:07:01.760 --> 0:07:05.120
<v Speaker 1>distinct branch of mathematics, when before it was just kind

0:07:05.120 --> 0:07:07.440
<v Speaker 1>of lumped in with other stuff. And he did a

0:07:07.440 --> 0:07:11.000
<v Speaker 1>lot of work and showing how to work various types

0:07:11.000 --> 0:07:13.600
<v Speaker 1>of equations and how to balance equations. And on a

0:07:13.680 --> 0:07:17.559
<v Speaker 1>personal note, this was something that I used to love

0:07:17.600 --> 0:07:20.400
<v Speaker 1>to do in my mathematics courses. I could really see

0:07:20.400 --> 0:07:23.800
<v Speaker 1>the beauty in determining if two sides of an equation

0:07:24.280 --> 0:07:27.880
<v Speaker 1>truly were equal. It was like an elegant puzzle, and

0:07:27.880 --> 0:07:30.440
<v Speaker 1>I really love that. But again, just to be clear,

0:07:30.560 --> 0:07:33.520
<v Speaker 1>my love of algebra and trigonometry is pretty much where

0:07:33.960 --> 0:07:37.120
<v Speaker 1>math and I parted ways, because when calculus came along,

0:07:37.640 --> 0:07:40.400
<v Speaker 1>I was I was pretty much done. So at that

0:07:40.440 --> 0:07:45.880
<v Speaker 1>point it was it was beyond my ken as they say. Anyway,

0:07:46.240 --> 0:07:50.000
<v Speaker 1>back to our Arabic scholar, he highlighted the importance and

0:07:50.040 --> 0:07:56.080
<v Speaker 1>effectiveness of using a methodical approach towards the solution of problems,

0:07:56.280 --> 0:07:59.480
<v Speaker 1>and that kind of gets at the heart of what

0:07:59.720 --> 0:08:04.440
<v Speaker 1>our gorhythms actually are. The basic definition, which I kind

0:08:04.440 --> 0:08:08.440
<v Speaker 1>of alluded to earlier is quote a process or set

0:08:08.560 --> 0:08:12.520
<v Speaker 1>of rules to be followed in calculations or other problems

0:08:12.520 --> 0:08:17.360
<v Speaker 1>solving operations, especially by a computer. End quote that's from

0:08:17.400 --> 0:08:21.120
<v Speaker 1>Oxford Languages. But you know this can apply to all

0:08:21.120 --> 0:08:23.960
<v Speaker 1>sorts of stuff. For example, if you've ever seen anyone

0:08:24.400 --> 0:08:28.400
<v Speaker 1>who can solve Rubics cubes, those those puzzles that are

0:08:28.520 --> 0:08:31.080
<v Speaker 1>in cube form where you've got all the little, uh

0:08:31.240 --> 0:08:33.320
<v Speaker 1>different colors of squares and your job is to make

0:08:33.760 --> 0:08:37.880
<v Speaker 1>each side of the cube the same color. Well, there

0:08:37.880 --> 0:08:40.880
<v Speaker 1>are people who can solve Rubik's cubes in in a

0:08:41.080 --> 0:08:44.040
<v Speaker 1>fraction of like, like less than a minute. It's it's

0:08:44.080 --> 0:08:46.920
<v Speaker 1>amazing to watch them go. It's so fast and it's

0:08:46.960 --> 0:08:49.600
<v Speaker 1>hard to keep up with what they're doing. They are

0:08:49.720 --> 0:08:56.280
<v Speaker 1>essentially following algorithms, these processes that will get to a

0:08:56.360 --> 0:09:02.640
<v Speaker 1>dependable and replicable outcome based on what you're doing. Um So,

0:09:02.679 --> 0:09:04.839
<v Speaker 1>an algorithm is really just a way for us to

0:09:05.200 --> 0:09:08.600
<v Speaker 1>problem solve. Let's say we have a particular outcome that

0:09:08.679 --> 0:09:12.120
<v Speaker 1>we want to achieve. The algorithm is the recipe that

0:09:12.160 --> 0:09:15.240
<v Speaker 1>we followed to go from whatever our starting condition is

0:09:15.360 --> 0:09:19.000
<v Speaker 1>our starting state. In order to get to the outcome

0:09:19.080 --> 0:09:22.080
<v Speaker 1>we want to our target state, it needs to be

0:09:22.559 --> 0:09:25.760
<v Speaker 1>well defined. Algorithms have to be well defined because computers

0:09:25.760 --> 0:09:30.439
<v Speaker 1>are not really capable of implementing vague instructions. It needs

0:09:30.440 --> 0:09:33.600
<v Speaker 1>to have a pretty solid approach so that the computer,

0:09:33.720 --> 0:09:37.000
<v Speaker 1>when following the algorithm quote unquote, knows exactly what to

0:09:37.040 --> 0:09:41.000
<v Speaker 1>do based upon the current state of the problem. It

0:09:41.040 --> 0:09:44.640
<v Speaker 1>also needs to be finite. Computers are not capable of

0:09:44.800 --> 0:09:49.200
<v Speaker 1>handling infinite possibilities, so the algorithm has to work within

0:09:49.280 --> 0:09:53.200
<v Speaker 1>certain parameters, and those parameters depend upon the nature of

0:09:53.240 --> 0:09:56.160
<v Speaker 1>the problem you're trying to solve. And the equipment that

0:09:56.240 --> 0:09:59.240
<v Speaker 1>you have to solve it with. So let's take a

0:09:59.320 --> 0:10:04.120
<v Speaker 1>problem that computers typically struggle to achieve, and that is

0:10:04.360 --> 0:10:08.720
<v Speaker 1>random number generation or r in G. Now you would

0:10:08.760 --> 0:10:13.000
<v Speaker 1>think that creating a random number would be easy. I mean,

0:10:13.040 --> 0:10:16.600
<v Speaker 1>we can do it just by throwing some dice for example, Right,

0:10:16.640 --> 0:10:19.000
<v Speaker 1>you can throw a die and and whatever the number

0:10:19.280 --> 0:10:23.080
<v Speaker 1>comes up, that's your random number. But computers have to

0:10:23.120 --> 0:10:28.280
<v Speaker 1>follow specific instructions and execute operations that by definition need

0:10:28.360 --> 0:10:32.120
<v Speaker 1>to have a predictable and replicable outcomes. So computers find

0:10:32.200 --> 0:10:37.160
<v Speaker 1>random number generation really tricky. Typically, the best we can

0:10:37.240 --> 0:10:40.280
<v Speaker 1>hope for when it comes down to this sort of

0:10:40.320 --> 0:10:44.360
<v Speaker 1>thing is pseudo random numbers. So these are numbers that,

0:10:44.480 --> 0:10:48.200
<v Speaker 1>to an extent, appear to be random, right Like, on

0:10:48.440 --> 0:10:53.640
<v Speaker 1>casual observation, it looks like the computer is generating random numbers. However,

0:10:53.679 --> 0:10:57.440
<v Speaker 1>if you were to really seriously dig down into the process,

0:10:57.880 --> 0:11:00.840
<v Speaker 1>you might discover that they are not really really random

0:11:00.880 --> 0:11:04.480
<v Speaker 1>at all. But we just need them to be random enough, right.

0:11:04.559 --> 0:11:07.440
<v Speaker 1>We need it to be close enough to seeming to

0:11:07.480 --> 0:11:10.200
<v Speaker 1>be random for it to fulfill the function we need

0:11:10.600 --> 0:11:13.719
<v Speaker 1>if it's not truly random. For a lot of applications

0:11:14.280 --> 0:11:19.040
<v Speaker 1>that ends up being, you know, negligible. On a related note,

0:11:19.440 --> 0:11:22.640
<v Speaker 1>there are some types of mathematical problems that have many

0:11:22.679 --> 0:11:27.000
<v Speaker 1>degrees of freedom lots of variables, for example. So a

0:11:27.080 --> 0:11:29.079
<v Speaker 1>problem that does have a lot of variables could have

0:11:29.080 --> 0:11:31.679
<v Speaker 1>a lot of potential solutions, and so it could be

0:11:31.720 --> 0:11:35.200
<v Speaker 1>a challenge for computers to solve. We need algorithms to

0:11:35.200 --> 0:11:38.760
<v Speaker 1>tackle these sorts of problems, to go at them in

0:11:38.800 --> 0:11:43.960
<v Speaker 1>ways that go beyond deterministic computation, which I guess I

0:11:44.000 --> 0:11:48.880
<v Speaker 1>should define that. So, deterministic computation refers to a process

0:11:48.920 --> 0:11:53.720
<v Speaker 1>in which each successive state of an operation depends completely

0:11:53.800 --> 0:11:58.360
<v Speaker 1>on the previous state. So what comes next always depends

0:11:58.440 --> 0:12:01.840
<v Speaker 1>upon what came just before. And I'll give you an example.

0:12:02.160 --> 0:12:03.840
<v Speaker 1>Let's say I give you a math problem, and I

0:12:03.920 --> 0:12:06.439
<v Speaker 1>say you need to add these two numbers together. And

0:12:06.520 --> 0:12:10.120
<v Speaker 1>let's say it's like, uh, five and six, and then

0:12:10.320 --> 0:12:13.800
<v Speaker 1>from the sum of those numbers you have to subtract four. Well,

0:12:14.000 --> 0:12:16.680
<v Speaker 1>you would first add those two numbers together, so five

0:12:16.720 --> 0:12:19.880
<v Speaker 1>plus six you got eleven, and then you would subtract

0:12:20.440 --> 0:12:24.960
<v Speaker 1>four from that number, and so eleven minus four equal seven.

0:12:25.559 --> 0:12:28.880
<v Speaker 1>And this process is deterministic because I gave you those

0:12:28.880 --> 0:12:34.319
<v Speaker 1>specific instructions that computers do really well with deterministic processes.

0:12:34.400 --> 0:12:38.160
<v Speaker 1>These are pretty easy to follow. These sorts of processes

0:12:38.200 --> 0:12:41.880
<v Speaker 1>are by their nature replicable. So in other words, if

0:12:41.920 --> 0:12:44.959
<v Speaker 1>I ask you to do that same operation, if I

0:12:45.000 --> 0:12:48.200
<v Speaker 1>tell you add five and six together and then subtract four,

0:12:49.080 --> 0:12:51.120
<v Speaker 1>it doesn't matter how many times you are you do

0:12:51.240 --> 0:12:53.679
<v Speaker 1>that that process, right, You're always going to come out

0:12:54.280 --> 0:12:56.560
<v Speaker 1>with the same answer. It's always going to come back

0:12:56.920 --> 0:13:00.480
<v Speaker 1>no matter what you do, You're gonna always of seven

0:13:00.480 --> 0:13:04.160
<v Speaker 1>as your answer, just based on that same input. So

0:13:04.559 --> 0:13:08.560
<v Speaker 1>there are a family of algorithms that collectively get the

0:13:08.640 --> 0:13:13.400
<v Speaker 1>name Monte Carlo algorithms, and they're named after Monte Carlo,

0:13:13.640 --> 0:13:16.120
<v Speaker 1>the area of Monaco that is famous for being the

0:13:16.160 --> 0:13:20.199
<v Speaker 1>location of lots of high end casinos have been there.

0:13:20.679 --> 0:13:24.800
<v Speaker 1>It's not really my jam, but it is pretty darn flashy.

0:13:24.920 --> 0:13:29.280
<v Speaker 1>So the reason these algorithms get the name Monte Carlo

0:13:29.360 --> 0:13:34.120
<v Speaker 1>algorithms is that, like gambling, they deal with an element

0:13:34.200 --> 0:13:39.400
<v Speaker 1>of randomization. So gambling is called gambling because you're taking

0:13:39.400 --> 0:13:43.480
<v Speaker 1>a risk. You're gambling, you're betting that you're gonna beat

0:13:43.520 --> 0:13:46.120
<v Speaker 1>the odds in whichever game it is that you're playing.

0:13:46.240 --> 0:13:49.160
<v Speaker 1>And that you're going to achieve an outcome that's favorable

0:13:49.200 --> 0:13:52.839
<v Speaker 1>to you, which you experience as a payout. So, whether

0:13:52.880 --> 0:13:56.440
<v Speaker 1>it's throwing dice or playing a card game, or placing

0:13:56.440 --> 0:14:00.000
<v Speaker 1>bets at a roulette wheel or playing a slot machine,

0:14:00.040 --> 0:14:02.560
<v Speaker 1>you are engaged in an activity in which there is

0:14:02.800 --> 0:14:06.480
<v Speaker 1>some element of chance, at least in theory if the

0:14:06.520 --> 0:14:09.720
<v Speaker 1>game is honest, and what you're hoping for is that

0:14:10.120 --> 0:14:16.160
<v Speaker 1>chance lands in your favor. Similarly, Monte Carlo algorithms often

0:14:16.200 --> 0:14:19.920
<v Speaker 1>focus on chance and risk assessments such as what are

0:14:19.920 --> 0:14:23.760
<v Speaker 1>the odds that if I do this one thing, I'm

0:14:23.760 --> 0:14:27.560
<v Speaker 1>gonna totally regret doing it later? But you know, more

0:14:27.600 --> 0:14:31.720
<v Speaker 1>of the a computational problem and not a lifestyle choice. Well,

0:14:31.760 --> 0:14:37.680
<v Speaker 1>back in ninet, scientists at the Los Alamos Scientific Laboratory,

0:14:37.840 --> 0:14:41.800
<v Speaker 1>including John von Neumann, uh stand All Lam and Nick

0:14:41.880 --> 0:14:46.479
<v Speaker 1>Metropolis propose what would become known as the Metropolis algorithm,

0:14:46.680 --> 0:14:50.320
<v Speaker 1>one of the Monte Carlo algorithms, and the purpose of

0:14:50.320 --> 0:14:55.960
<v Speaker 1>this algorithm was to approximate solutions two very complicated mathematical

0:14:56.040 --> 0:15:01.480
<v Speaker 1>problems where going through a deterministic approach to find the

0:15:01.520 --> 0:15:05.080
<v Speaker 1>definitive answer just wasn't feasible. So In other words, for

0:15:05.240 --> 0:15:09.000
<v Speaker 1>certain complicated math problems, figuring out the quote unquote real

0:15:09.200 --> 0:15:12.440
<v Speaker 1>answer would really just take too long, perhaps to the

0:15:12.440 --> 0:15:15.239
<v Speaker 1>point where you would never get there within your lifetime.

0:15:15.560 --> 0:15:17.440
<v Speaker 1>So you need a way to kind of get a

0:15:17.480 --> 0:15:22.360
<v Speaker 1>ballpark solution that hopefully is closer to being correct than incorrect.

0:15:23.320 --> 0:15:25.360
<v Speaker 1>Doesn't sound like the sort of thing that computers would

0:15:25.360 --> 0:15:27.640
<v Speaker 1>be particularly good at doing right off the bat, right.

0:15:28.240 --> 0:15:33.040
<v Speaker 1>In fact, the algorithm allows computers to mimic a randomized process,

0:15:33.320 --> 0:15:37.400
<v Speaker 1>so it's not truly random, but it's random ish if

0:15:37.440 --> 0:15:40.400
<v Speaker 1>you like, and it uses this to approximate a solution

0:15:40.480 --> 0:15:43.200
<v Speaker 1>to whatever the problem is that you're trying to solve

0:15:43.240 --> 0:15:46.920
<v Speaker 1>that falls into this category. I once saw a simulation

0:15:47.280 --> 0:15:51.120
<v Speaker 1>of a randomized process using the Monte Carlo method that

0:15:51.200 --> 0:15:55.000
<v Speaker 1>I thought was pretty nifty, and it was determining what

0:15:55.160 --> 0:15:57.360
<v Speaker 1>is the value of pie. Let's say that you don't

0:15:57.440 --> 0:16:00.800
<v Speaker 1>know the value of pie and you're just trying to

0:16:00.840 --> 0:16:03.000
<v Speaker 1>figure it out. So and by the way, I mean

0:16:03.040 --> 0:16:05.400
<v Speaker 1>pie is in p I not as in the delicious

0:16:06.000 --> 0:16:10.160
<v Speaker 1>pie dessert treat. So here's the scenario. Imagine that you've

0:16:10.200 --> 0:16:12.600
<v Speaker 1>got a table and the tables like, I don't know,

0:16:13.120 --> 0:16:17.000
<v Speaker 1>three ft to a side, and positioned over this table

0:16:17.120 --> 0:16:20.280
<v Speaker 1>is a robotic arm. And this robotic arm can pick

0:16:20.400 --> 0:16:24.920
<v Speaker 1>up and drop large ball bearings onto the table, and

0:16:25.200 --> 0:16:27.720
<v Speaker 1>the arm can just move over the entire region of

0:16:27.760 --> 0:16:29.560
<v Speaker 1>the table, so it's got a three ft by three

0:16:29.640 --> 0:16:34.040
<v Speaker 1>ft range of motion. And in on this table you

0:16:34.200 --> 0:16:38.080
<v Speaker 1>set down two containers. You've got one that's that's a

0:16:38.080 --> 0:16:42.920
<v Speaker 1>circular container and one that's square. And the square container

0:16:43.040 --> 0:16:47.400
<v Speaker 1>measures six inches to a side. The radius of the

0:16:47.480 --> 0:16:50.840
<v Speaker 1>circular container is also six inches, so that means it's

0:16:50.840 --> 0:16:55.080
<v Speaker 1>got a twelve inch diameter. Right, So those are your containers,

0:16:55.520 --> 0:16:58.440
<v Speaker 1>and you've got your situation with your your robot arm

0:16:58.720 --> 0:17:02.280
<v Speaker 1>above this three ft square table. So the robotic arms

0:17:02.360 --> 0:17:06.680
<v Speaker 1>job is to pick up ball bearings and then from

0:17:06.680 --> 0:17:10.879
<v Speaker 1>a random que will drop that ball bearing somewhere above

0:17:10.960 --> 0:17:13.600
<v Speaker 1>the table. So some of those balls are going to

0:17:13.680 --> 0:17:16.280
<v Speaker 1>fall into the square container, some of them are going

0:17:16.320 --> 0:17:19.040
<v Speaker 1>to fall into the round container, some of them are

0:17:19.040 --> 0:17:22.200
<v Speaker 1>not going to fall in either. And if the process

0:17:22.320 --> 0:17:25.760
<v Speaker 1>is truly random, meaning there's an equal chance that it

0:17:25.800 --> 0:17:28.679
<v Speaker 1>will drop a ball bearing over any given point of

0:17:28.720 --> 0:17:32.480
<v Speaker 1>that table, over time, we would expect to see more

0:17:32.520 --> 0:17:36.119
<v Speaker 1>ball bearings fall into the round container because it has

0:17:36.160 --> 0:17:39.800
<v Speaker 1>a greater area and there's more space for a ball

0:17:39.840 --> 0:17:43.120
<v Speaker 1>bearing to fall into one of these. At the end

0:17:43.119 --> 0:17:47.240
<v Speaker 1>of repeating this process many, many times, we should be

0:17:47.320 --> 0:17:50.600
<v Speaker 1>able to take these two containers and then count the

0:17:50.680 --> 0:17:53.600
<v Speaker 1>number of ball bearings in each of them. And if

0:17:53.640 --> 0:17:56.919
<v Speaker 1>we divide the number of ball bearings in the circular

0:17:57.000 --> 0:17:59.920
<v Speaker 1>container by the number of ball bearings that fell into

0:18:00.040 --> 0:18:03.399
<v Speaker 1>the square container, we're gonna get results that should be

0:18:03.640 --> 0:18:09.920
<v Speaker 1>really close to pie. And you might think, wait, why

0:18:09.960 --> 0:18:13.160
<v Speaker 1>why would the number of ball bearings in one container

0:18:13.280 --> 0:18:17.520
<v Speaker 1>versus another, and then dividing those why would you get pie? Well,

0:18:17.560 --> 0:18:21.280
<v Speaker 1>if you have a process that is uniformly random across

0:18:21.320 --> 0:18:24.879
<v Speaker 1>an area, like our hypothetical three ft square table, the

0:18:24.960 --> 0:18:28.560
<v Speaker 1>probability that a dropped ball bearing will land in one

0:18:28.600 --> 0:18:32.879
<v Speaker 1>of those two specific containers is proportional to that specific

0:18:32.920 --> 0:18:37.439
<v Speaker 1>containers area or cross section. So then we just ask, all, right, well,

0:18:37.440 --> 0:18:39.800
<v Speaker 1>how do we define area? Well, with the square, it's

0:18:39.840 --> 0:18:42.360
<v Speaker 1>really simple, right. We take one side of a square

0:18:42.880 --> 0:18:45.840
<v Speaker 1>in this case, it's six inches, and we multiply it

0:18:45.880 --> 0:18:48.760
<v Speaker 1>by itself six times six. Because all sides of a

0:18:48.800 --> 0:18:50.960
<v Speaker 1>square are equal, we know that the length and the

0:18:51.000 --> 0:18:53.480
<v Speaker 1>width are each going to be six inches. We multiply

0:18:53.520 --> 0:18:56.720
<v Speaker 1>those together. We get thirty six square inches. That is

0:18:56.760 --> 0:19:00.520
<v Speaker 1>the area or cross section of our square container. But

0:19:00.640 --> 0:19:04.639
<v Speaker 1>for our circular container, we take the radius, which again

0:19:05.000 --> 0:19:07.600
<v Speaker 1>this case, the radius is six inches, and we square

0:19:07.640 --> 0:19:12.360
<v Speaker 1>it and then we multiply that number by pie. So

0:19:12.680 --> 0:19:17.200
<v Speaker 1>area for the circular container is six times six squared

0:19:17.359 --> 0:19:20.679
<v Speaker 1>times pie. And if we divide the cross section of

0:19:20.720 --> 0:19:24.680
<v Speaker 1>the circular container by the cross section of the square container,

0:19:25.320 --> 0:19:29.879
<v Speaker 1>the two six squared you know, the two elements the

0:19:29.960 --> 0:19:32.840
<v Speaker 1>squared elements cancel each other out, and so all we're

0:19:32.920 --> 0:19:36.600
<v Speaker 1>left with is pie. So the end result is that

0:19:36.680 --> 0:19:39.760
<v Speaker 1>when we count up these ball bearings that have landed

0:19:39.840 --> 0:19:43.960
<v Speaker 1>randomly in these containers, that that difference, the division that

0:19:44.040 --> 0:19:48.000
<v Speaker 1>we get that should be a close approximation of pie.

0:19:48.040 --> 0:19:50.520
<v Speaker 1>Now it's not going to be precise. Chances are the

0:19:50.600 --> 0:19:53.119
<v Speaker 1>number of ball bearings in the two containers will just

0:19:53.200 --> 0:19:56.600
<v Speaker 1>get you close to pie. But it illustrates how a

0:19:56.720 --> 0:20:01.080
<v Speaker 1>randomized process can help you get to a particular solution

0:20:01.119 --> 0:20:05.040
<v Speaker 1>that might otherwise be difficult to ascertain. There are videos

0:20:05.080 --> 0:20:08.000
<v Speaker 1>on YouTube that show this particular simulation. It's kind of

0:20:08.000 --> 0:20:10.640
<v Speaker 1>a famous one. So you can actually watch and get

0:20:10.960 --> 0:20:12.959
<v Speaker 1>kind of an understanding of what I said to you

0:20:13.000 --> 0:20:16.719
<v Speaker 1>makes no sense whatsoever. There are other options for you

0:20:16.800 --> 0:20:20.000
<v Speaker 1>to look into that might help, And that is a

0:20:20.040 --> 0:20:23.639
<v Speaker 1>great example. But what are the actual algorithms that fall

0:20:23.720 --> 0:20:27.160
<v Speaker 1>into the Monte Carlo methods spectrum? What are they used

0:20:27.160 --> 0:20:30.000
<v Speaker 1>to do well? They can be used to simulate things

0:20:30.119 --> 0:20:35.000
<v Speaker 1>like fluid dynamics, or cellular structures or the interaction of

0:20:35.080 --> 0:20:39.000
<v Speaker 1>disordered materials. So in other words, these are all processes.

0:20:39.320 --> 0:20:42.800
<v Speaker 1>They have a lot of potential variables at play, and

0:20:42.880 --> 0:20:46.480
<v Speaker 1>you can think of variables as representing uncertainty, something that

0:20:46.560 --> 0:20:50.600
<v Speaker 1>computers typically don't do well with. You know, from a

0:20:50.680 --> 0:20:57.400
<v Speaker 1>general stance, computers excel at specific instances rather than potential instances.

0:20:57.440 --> 0:21:01.760
<v Speaker 1>So algorithms like the Metropolis algor rhythm would lead computer

0:21:01.840 --> 0:21:05.840
<v Speaker 1>scientists to develop methodologies to kind of work around the

0:21:05.880 --> 0:21:11.760
<v Speaker 1>limitations of computers and leverage computational power and tackling very

0:21:11.800 --> 0:21:16.159
<v Speaker 1>difficult problems in that way. In the Monte Carlo family

0:21:16.200 --> 0:21:19.280
<v Speaker 1>of algorithms, we typically assume that the results we get

0:21:19.760 --> 0:21:23.359
<v Speaker 1>are going to have a potential for being wrong, like

0:21:23.400 --> 0:21:25.800
<v Speaker 1>there'll be a small percentage of error that we have

0:21:25.840 --> 0:21:28.520
<v Speaker 1>to take into account, and so keeping that in mind,

0:21:28.560 --> 0:21:32.199
<v Speaker 1>we need to frame results as being again approximations of

0:21:32.200 --> 0:21:35.280
<v Speaker 1>an answer, rather than the definitive answer to whatever problem

0:21:35.320 --> 0:21:38.159
<v Speaker 1>it is we're trying to solve. For me, this was

0:21:38.200 --> 0:21:40.400
<v Speaker 1>one of those things that was very difficult to grasp

0:21:40.600 --> 0:21:43.760
<v Speaker 1>for a long time because I was equating it to

0:21:44.040 --> 0:21:47.320
<v Speaker 1>math class, where you're supposed to get the answer. Now,

0:21:47.320 --> 0:21:49.440
<v Speaker 1>when we come back, we'll talk about a few more

0:21:49.560 --> 0:21:52.520
<v Speaker 1>famous algorithms and what they do. But first let's take

0:21:52.760 --> 0:22:02.960
<v Speaker 1>a quick break. Now. In our previous section, I talked

0:22:02.960 --> 0:22:05.680
<v Speaker 1>about a family of algorithms that trace their history back

0:22:05.680 --> 0:22:09.080
<v Speaker 1>to nineteen and so does the next one I want

0:22:09.119 --> 0:22:12.800
<v Speaker 1>to talk about, which was created by George Dantzig, who

0:22:12.960 --> 0:22:17.240
<v Speaker 1>worked for the Rand Corporation. And Danzig created a process

0:22:17.359 --> 0:22:20.840
<v Speaker 1>that would lead to what we call linear programming. So

0:22:21.119 --> 0:22:24.959
<v Speaker 1>at its most basic level, linear programming is about taking

0:22:25.040 --> 0:22:29.639
<v Speaker 1>some function and maximizing or minimizing that function with regard

0:22:29.720 --> 0:22:33.200
<v Speaker 1>to various constraints. But that is super vague, right, I mean,

0:22:33.240 --> 0:22:35.879
<v Speaker 1>it's not terribly helpful. It feels like I'm talking in

0:22:35.880 --> 0:22:39.520
<v Speaker 1>a circle. But this is one that's really important for say,

0:22:39.680 --> 0:22:42.960
<v Speaker 1>business developers. So let's talk about a slightly more specific

0:22:43.080 --> 0:22:46.160
<v Speaker 1>use case. Let's say that you are launching a business

0:22:46.960 --> 0:22:49.680
<v Speaker 1>and you're trying to make some you know, big decisions

0:22:49.840 --> 0:22:51.919
<v Speaker 1>as you're going to do this, and you're going to

0:22:52.240 --> 0:22:57.000
<v Speaker 1>manufacture and sell a product of some sort, some physical thing. Now,

0:22:57.040 --> 0:22:59.840
<v Speaker 1>your whole goal as a business is to make money

0:23:00.280 --> 0:23:02.919
<v Speaker 1>from the work you do, and to do that, you

0:23:02.960 --> 0:23:05.159
<v Speaker 1>need to figure out what your costs are going to

0:23:05.240 --> 0:23:09.359
<v Speaker 1>be and how you cannot just offset these costs but

0:23:09.960 --> 0:23:13.960
<v Speaker 1>make enough money to actually profit from it, so cover

0:23:14.000 --> 0:23:17.439
<v Speaker 1>all your costs plus some extra. So in this case,

0:23:17.920 --> 0:23:20.040
<v Speaker 1>what you're trying to do is figuring out how you

0:23:20.080 --> 0:23:26.200
<v Speaker 1>can minimize costs and maximize profits. Right. The constraints come

0:23:26.200 --> 0:23:29.399
<v Speaker 1>into play as you start to look at specifics, like

0:23:29.560 --> 0:23:32.760
<v Speaker 1>maybe you're gonna partner with a fabrication company, and maybe

0:23:32.760 --> 0:23:35.280
<v Speaker 1>you've actually got a few choices. You've got different companies

0:23:35.320 --> 0:23:37.720
<v Speaker 1>that you could go with. Well, these choices could represent

0:23:37.800 --> 0:23:41.600
<v Speaker 1>constraints in your approach. Perhaps one is more expensive than

0:23:41.640 --> 0:23:45.200
<v Speaker 1>the others, but it can produce a greater volume of product,

0:23:45.760 --> 0:23:48.399
<v Speaker 1>so you'd be able to get more product out to

0:23:48.480 --> 0:23:52.440
<v Speaker 1>market in less time. Or maybe you've got one that's

0:23:52.440 --> 0:23:57.320
<v Speaker 1>more expensive but it's also less likely to have fabrication errors,

0:23:57.359 --> 0:24:00.400
<v Speaker 1>and errors can be both costly and time can assuming

0:24:00.440 --> 0:24:04.320
<v Speaker 1>to address. So you have to quantify all these variables

0:24:04.400 --> 0:24:07.440
<v Speaker 1>and use them as constraints to start figuring out your

0:24:07.520 --> 0:24:11.840
<v Speaker 1>men maxing approach. Here, linear programming simply looks for the

0:24:11.880 --> 0:24:16.000
<v Speaker 1>optimum value of a linear expression, and depending on the

0:24:16.040 --> 0:24:20.560
<v Speaker 1>problem you're trying to solve, like maximizing profit versus minimizing costs,

0:24:20.800 --> 0:24:24.359
<v Speaker 1>you're either looking for the highest value being optimum or

0:24:24.400 --> 0:24:27.240
<v Speaker 1>the lowest value being optimum. Like with costs, you want

0:24:27.280 --> 0:24:29.440
<v Speaker 1>that to be the lowest, and you have to look

0:24:29.440 --> 0:24:33.159
<v Speaker 1>at what constraints are at play with any given expression.

0:24:33.720 --> 0:24:37.480
<v Speaker 1>So Danzing's approach to linear programming, called the simplex method,

0:24:37.960 --> 0:24:41.400
<v Speaker 1>was efficient and elegant and far more simplified than other

0:24:41.520 --> 0:24:45.120
<v Speaker 1>methodologies attempting to kind of do the same thing around

0:24:45.160 --> 0:24:48.160
<v Speaker 1>that time. But it also had some limitations, and that's

0:24:48.200 --> 0:24:52.400
<v Speaker 1>because the real world isn't as simple as math tends

0:24:52.480 --> 0:24:55.520
<v Speaker 1>to be. Like math tends to be pretty, you know,

0:24:56.440 --> 0:24:58.879
<v Speaker 1>firm in the grand scheme of things in the world

0:24:58.920 --> 0:25:02.160
<v Speaker 1>is a little more wibbly. Doubly, so, a linear programming

0:25:02.200 --> 0:25:06.560
<v Speaker 1>solution only works if the various relationships between the different

0:25:06.600 --> 0:25:10.040
<v Speaker 1>elements like the requirements and the restrictions and constraints that

0:25:10.080 --> 0:25:12.320
<v Speaker 1>you've set up with this problem. It only works if

0:25:12.359 --> 0:25:15.240
<v Speaker 1>all of those relationships are linear, or, in other words,

0:25:15.440 --> 0:25:18.600
<v Speaker 1>for a given change in one variable, we see a

0:25:18.720 --> 0:25:23.280
<v Speaker 1>given change in other variables. And that is super vague,

0:25:23.320 --> 0:25:25.719
<v Speaker 1>So we're going to talk about two variables. Will reduce

0:25:25.760 --> 0:25:29.120
<v Speaker 1>it down to that. So we'll use the classic X

0:25:29.160 --> 0:25:31.879
<v Speaker 1>and Y as our variables. Those can stand in for

0:25:31.920 --> 0:25:35.520
<v Speaker 1>all sorts of different values. And let's say that we

0:25:35.640 --> 0:25:38.880
<v Speaker 1>see there's a relationship between X and Y, and that

0:25:38.960 --> 0:25:43.520
<v Speaker 1>if the value of X changes from one to two,

0:25:43.960 --> 0:25:46.240
<v Speaker 1>we then see that the value of Y goes from

0:25:46.440 --> 0:25:50.000
<v Speaker 1>three to nine. Well, that doesn't tell us anything on

0:25:50.040 --> 0:25:52.920
<v Speaker 1>its own, right, We just know that if x is one,

0:25:53.440 --> 0:25:56.120
<v Speaker 1>y is three. If x is two, y is nine.

0:25:56.600 --> 0:26:00.240
<v Speaker 1>If we then see that if x is three, then

0:26:00.320 --> 0:26:04.280
<v Speaker 1>why is fifteen? And when x is four, why is

0:26:04.320 --> 0:26:09.359
<v Speaker 1>twenty one? We start to see a linear relationship because

0:26:09.400 --> 0:26:13.480
<v Speaker 1>each time X increases by one, why increases by six.

0:26:13.960 --> 0:26:18.600
<v Speaker 1>The rate of increase for each variable is linear. It's

0:26:18.640 --> 0:26:22.040
<v Speaker 1>it's not like the rate of increase doesn't change. So

0:26:22.280 --> 0:26:26.440
<v Speaker 1>we've got this linear relationship here. We can contrast this

0:26:26.560 --> 0:26:32.000
<v Speaker 1>with exponential relationships, in which we see not a constant increase,

0:26:32.320 --> 0:26:36.520
<v Speaker 1>but a constant ratio in successive terms in one variable

0:26:36.800 --> 0:26:39.920
<v Speaker 1>when you change another. So in this case, let's say

0:26:39.920 --> 0:26:42.879
<v Speaker 1>that we find out then, when X is one, why

0:26:43.000 --> 0:26:47.080
<v Speaker 1>is three? When X is two, why is nine? When

0:26:47.200 --> 0:26:50.760
<v Speaker 1>X is three, why is twenties seven? Now we see

0:26:50.800 --> 0:26:54.560
<v Speaker 1>that why is not increasing by six each time. We're

0:26:54.560 --> 0:26:59.280
<v Speaker 1>seeing that the value of why is multiplied by three

0:26:59.720 --> 0:27:02.320
<v Speaker 1>each time X goes up once. So we're seeing there's

0:27:02.320 --> 0:27:06.439
<v Speaker 1>a constant ratio of change with why with regard to X.

0:27:06.920 --> 0:27:11.200
<v Speaker 1>This gets into an exponential relationship. So when someone describes

0:27:11.280 --> 0:27:15.679
<v Speaker 1>something is having exponential growth, what this is supposed to

0:27:15.720 --> 0:27:20.560
<v Speaker 1>mean is that you should see a rate of growth

0:27:20.760 --> 0:27:25.399
<v Speaker 1>that is increasing by some exponent for given unit of time.

0:27:25.760 --> 0:27:29.000
<v Speaker 1>So it's not just that the thing is growing. In fact,

0:27:29.040 --> 0:27:32.240
<v Speaker 1>it's not even that the thing is growing quickly. It's

0:27:32.320 --> 0:27:35.880
<v Speaker 1>that the thing is growing faster as time goes on,

0:27:36.040 --> 0:27:39.800
<v Speaker 1>so that you would say today it's growing, you know,

0:27:39.880 --> 0:27:42.240
<v Speaker 1>say twice as fast as it was growing yesterday, and

0:27:42.280 --> 0:27:44.359
<v Speaker 1>tomorrow it will grow twice as fast as it was

0:27:44.440 --> 0:27:48.280
<v Speaker 1>growing today. And a lot of people use this phrase incorrectly.

0:27:48.840 --> 0:27:52.919
<v Speaker 1>We often really just mean yo, that thing is growing

0:27:53.000 --> 0:27:57.200
<v Speaker 1>wicked fast, but we don't necessarily mean yo, that thing

0:27:57.280 --> 0:27:59.840
<v Speaker 1>is growing wicked fast, and the rate of growth increases

0:27:59.840 --> 0:28:05.120
<v Speaker 1>by a constant amount over time, So you know, it's

0:28:05.240 --> 0:28:09.040
<v Speaker 1>it's an important distinction to make. Anyway, that was a

0:28:09.080 --> 0:28:11.840
<v Speaker 1>bit of a tangent to say that linear programming works

0:28:11.960 --> 0:28:15.680
<v Speaker 1>if the relationships between all the variables is in fact linear.

0:28:16.160 --> 0:28:19.560
<v Speaker 1>But if if it's not, If the relationship, say is

0:28:19.640 --> 0:28:24.639
<v Speaker 1>exponential or logarithmic or anything like that, linear programming doesn't apply.

0:28:25.280 --> 0:28:28.600
<v Speaker 1>And the real world is pretty darn complicated. So linear

0:28:28.640 --> 0:28:31.960
<v Speaker 1>programming relies on sort of kind of dumbing down what's

0:28:32.000 --> 0:28:34.760
<v Speaker 1>really going on in the real world. Two. Again, more

0:28:34.800 --> 0:28:37.840
<v Speaker 1>of an approximation, and the solution that you arrive at

0:28:37.960 --> 0:28:40.760
<v Speaker 1>might not be the ideal solution, but it might be

0:28:40.920 --> 0:28:43.479
<v Speaker 1>good enough, depending upon what it is you're trying to do.

0:28:44.200 --> 0:28:47.680
<v Speaker 1>Another limitation of linear programming is that as you add

0:28:47.720 --> 0:28:51.000
<v Speaker 1>more variables to a problem, This is specific to the

0:28:51.040 --> 0:28:54.920
<v Speaker 1>simplex method. As you add more variables, well, it grows

0:28:54.960 --> 0:28:59.000
<v Speaker 1>more difficult to lay out in a linear fashion. You're

0:28:59.040 --> 0:29:04.280
<v Speaker 1>you're adding more uncertainty, and the methodology has trouble dealing

0:29:04.320 --> 0:29:09.560
<v Speaker 1>with additional uncertainty. Perhaps ironically, the complexity of the linear

0:29:09.640 --> 0:29:14.160
<v Speaker 1>function would grow exponentially as more variables joined a problem.

0:29:14.200 --> 0:29:18.440
<v Speaker 1>So this process would be unsuitable for certain subsets of

0:29:18.520 --> 0:29:21.719
<v Speaker 1>computational problems because they just would get so complex that

0:29:21.760 --> 0:29:24.160
<v Speaker 1>even the most advanced computers in the world wouldn't be

0:29:24.160 --> 0:29:28.320
<v Speaker 1>able to handle them. Later on, other mathematicians would propose

0:29:28.400 --> 0:29:32.320
<v Speaker 1>algorithms that could compensate for this particular limitation of the

0:29:32.360 --> 0:29:37.680
<v Speaker 1>simplex method. For example, there are polynomial time algorithms. We're

0:29:37.680 --> 0:29:41.040
<v Speaker 1>gonna leave that for the time being, because ain't no

0:29:41.120 --> 0:29:44.440
<v Speaker 1>way I'm going to get that right anyway. I wanted

0:29:44.440 --> 0:29:48.400
<v Speaker 1>to talk about those two algorithms, in particular, the Metropolis

0:29:48.440 --> 0:29:52.200
<v Speaker 1>algorithm and the simplex method, because they are the foundation

0:29:52.320 --> 0:29:55.080
<v Speaker 1>for a lot of work that's been done in computer science.

0:29:55.120 --> 0:29:59.479
<v Speaker 1>But let's get some really basic ideas in with the

0:29:59.520 --> 0:30:04.080
<v Speaker 1>next one. Let's talk about sorting. Sorting is all about

0:30:04.160 --> 0:30:07.600
<v Speaker 1>arranging a list of things in order with regard to

0:30:07.680 --> 0:30:13.520
<v Speaker 1>some specific feature of those things. That seems pretty basic, right,

0:30:13.560 --> 0:30:16.320
<v Speaker 1>I Mean, there's a real world example that I think

0:30:16.360 --> 0:30:18.280
<v Speaker 1>most of us have had in the past, which is

0:30:18.320 --> 0:30:21.640
<v Speaker 1>that let's say you're looking at an online store and

0:30:21.680 --> 0:30:26.720
<v Speaker 1>you're searching for a specific product or specific type of product.

0:30:26.800 --> 0:30:29.320
<v Speaker 1>Let's say it's a blender, because I had to do

0:30:29.400 --> 0:30:32.880
<v Speaker 1>this recently, right, So you go to some online store

0:30:32.920 --> 0:30:35.840
<v Speaker 1>and you're searching for blenders and you get results, Well,

0:30:35.880 --> 0:30:38.040
<v Speaker 1>you might actually want to sort those results by a

0:30:38.080 --> 0:30:40.240
<v Speaker 1>specific way. Maybe you want to sort it by price,

0:30:40.360 --> 0:30:42.400
<v Speaker 1>and you want to go low to high because you

0:30:42.440 --> 0:30:44.479
<v Speaker 1>have a specific budget, so you just want to look at,

0:30:45.000 --> 0:30:47.600
<v Speaker 1>you know, blenders that are an x price or less.

0:30:48.440 --> 0:30:51.160
<v Speaker 1>Maybe you want to sort it by high price too

0:30:51.200 --> 0:30:53.760
<v Speaker 1>low because maybe you're a fat cat tycoon type and

0:30:53.760 --> 0:30:55.840
<v Speaker 1>you're just thinking, I want whatever is the most expensive.

0:30:56.600 --> 0:30:59.360
<v Speaker 1>Or maybe you want to sort the results by customer

0:30:59.440 --> 0:31:03.520
<v Speaker 1>review because we know rice and quality don't always go

0:31:03.640 --> 0:31:06.400
<v Speaker 1>hand in hand. Maybe you just want to look at

0:31:06.440 --> 0:31:08.920
<v Speaker 1>all the blenders in alphabetical order, or maybe you want

0:31:08.920 --> 0:31:11.920
<v Speaker 1>to look at them in a reverse alphabetical order. You

0:31:12.000 --> 0:31:15.720
<v Speaker 1>do you. Sorting is one of those most basic functions

0:31:16.160 --> 0:31:19.880
<v Speaker 1>and heavily studied concepts within computer science, so much so

0:31:20.040 --> 0:31:25.640
<v Speaker 1>that a lot of programming language libraries have sorting functions

0:31:25.640 --> 0:31:29.240
<v Speaker 1>built into them. But it's still one of those things

0:31:29.240 --> 0:31:31.640
<v Speaker 1>that people look at to see if there are better

0:31:31.680 --> 0:31:36.240
<v Speaker 1>ways to sort various types of data, particularly as you

0:31:36.280 --> 0:31:42.200
<v Speaker 1>get into a larger number of of sortable features um

0:31:42.240 --> 0:31:45.440
<v Speaker 1>and it becomes really important. So let's take Google's search

0:31:45.480 --> 0:31:49.680
<v Speaker 1>algorithm for example. Now, that name suggests that the algorithm

0:31:49.720 --> 0:31:52.600
<v Speaker 1>we're talking about is related to the process of searching

0:31:52.640 --> 0:31:55.720
<v Speaker 1>the web for pages that relate to a given search query,

0:31:55.960 --> 0:31:58.600
<v Speaker 1>and in fact, Google does have a search algorithm that

0:31:58.680 --> 0:32:01.440
<v Speaker 1>does this. But most of the time I hear people

0:32:01.480 --> 0:32:05.760
<v Speaker 1>talking about the search algorithm, they actually mean that the

0:32:05.840 --> 0:32:10.280
<v Speaker 1>algorithm that Google relies upon to determine what the order

0:32:10.440 --> 0:32:13.280
<v Speaker 1>of search results are going to be that a person

0:32:13.320 --> 0:32:15.680
<v Speaker 1>sees when they search for, you know, whatever it might be.

0:32:16.600 --> 0:32:20.840
<v Speaker 1>This is critically important because multiple studies have shown that

0:32:20.880 --> 0:32:23.840
<v Speaker 1>most people never bother to go beyond the first page

0:32:23.880 --> 0:32:27.400
<v Speaker 1>of search results, which means that Google really needs to

0:32:27.400 --> 0:32:30.480
<v Speaker 1>do its best to make sure that the most relevant

0:32:30.600 --> 0:32:35.000
<v Speaker 1>results to any given search query show up toward the

0:32:35.040 --> 0:32:38.520
<v Speaker 1>top of this list, because most people are never going

0:32:38.560 --> 0:32:41.480
<v Speaker 1>to bother going any further than that. And if those

0:32:41.480 --> 0:32:44.560
<v Speaker 1>people decide that Google search results just aren't any good,

0:32:45.040 --> 0:32:48.200
<v Speaker 1>they could conceivably use some other search engine. And let

0:32:48.200 --> 0:32:53.440
<v Speaker 1>me tell you. Google hates that idea. So Google's goal

0:32:53.800 --> 0:32:56.960
<v Speaker 1>is to present to users search results that are most

0:32:57.040 --> 0:33:00.400
<v Speaker 1>likely going to meet whatever their needs are based on

0:33:00.560 --> 0:33:03.800
<v Speaker 1>their search criteria. And way back in the day, Google

0:33:04.160 --> 0:33:08.560
<v Speaker 1>relied pretty much solely on an algorithm called page rank,

0:33:09.760 --> 0:33:13.040
<v Speaker 1>and from what I understand, Google still relies on page rink,

0:33:13.080 --> 0:33:17.280
<v Speaker 1>but also makes use of several other algorithms to augment

0:33:17.720 --> 0:33:21.760
<v Speaker 1>page drink. But the page rank algorithm would take a

0:33:21.800 --> 0:33:25.800
<v Speaker 1>ton of stuff into account in the process of determining

0:33:26.440 --> 0:33:29.960
<v Speaker 1>where within a list of search results any given example

0:33:30.040 --> 0:33:35.400
<v Speaker 1>should appear. So let's say that I'm searching for blenders

0:33:35.440 --> 0:33:41.080
<v Speaker 1>on Google for some reason, and the search algorithm has

0:33:41.120 --> 0:33:43.959
<v Speaker 1>gone out and indexed a ton of web pages that

0:33:44.240 --> 0:33:47.920
<v Speaker 1>deal with blenders. Let's say that one of those results

0:33:48.640 --> 0:33:52.080
<v Speaker 1>is in a blog post that isn't that old, it's

0:33:52.120 --> 0:33:56.480
<v Speaker 1>fairly recent, but from a mostly unknown source, and very

0:33:56.520 --> 0:34:01.680
<v Speaker 1>few other documents are linking into this blog. Well, chances

0:34:01.720 --> 0:34:05.800
<v Speaker 1>are that search result would appear really far down on

0:34:05.840 --> 0:34:09.400
<v Speaker 1>the list, probably pages and pages and pages down on

0:34:09.440 --> 0:34:12.719
<v Speaker 1>the results. But then let's say that there's another web

0:34:12.760 --> 0:34:16.359
<v Speaker 1>page that belongs to an established entity, one that has

0:34:16.400 --> 0:34:19.319
<v Speaker 1>a good reputation that's been around for a while, and

0:34:19.360 --> 0:34:22.600
<v Speaker 1>there are a ton of other pages that link to

0:34:22.880 --> 0:34:27.120
<v Speaker 1>this particular website, well, that one would probably rank fairly

0:34:27.239 --> 0:34:31.920
<v Speaker 1>high on the list. So the page rank algorithm essentially

0:34:31.920 --> 0:34:36.040
<v Speaker 1>assigns a score to each search result, and the value

0:34:36.080 --> 0:34:39.040
<v Speaker 1>of that score depends upon lots of stuff I mentioned,

0:34:39.040 --> 0:34:42.240
<v Speaker 1>as well as tons of other variables, and these variables

0:34:42.239 --> 0:34:45.120
<v Speaker 1>can either boost a score higher or it can knock

0:34:45.239 --> 0:34:48.480
<v Speaker 1>some points off. And then page rank would take all

0:34:48.520 --> 0:34:52.760
<v Speaker 1>these different search results and order them based upon those scores.

0:34:53.120 --> 0:34:57.880
<v Speaker 1>Essentially really oversimplifying here, but the idea was that the

0:34:57.920 --> 0:35:02.239
<v Speaker 1>more reliable and therefore real event results would likely be

0:35:02.360 --> 0:35:06.000
<v Speaker 1>the ones that were the most popular, So all those

0:35:06.080 --> 0:35:08.600
<v Speaker 1>links that aimed at a page would count for a lot.

0:35:09.360 --> 0:35:13.320
<v Speaker 1>If you happen to run the definitive page on blenders

0:35:13.360 --> 0:35:17.160
<v Speaker 1>and everyone was linking to you, that would boost your

0:35:17.160 --> 0:35:21.800
<v Speaker 1>page links score significantly. Now, clearly, just because something is

0:35:21.840 --> 0:35:27.560
<v Speaker 1>popular doesn't necessarily mean it's the most relevant or valuable thing,

0:35:27.760 --> 0:35:33.839
<v Speaker 1>but it's generally more true than it isn't true. It

0:35:33.920 --> 0:35:37.320
<v Speaker 1>might not always be the absolute best result, but it

0:35:37.440 --> 0:35:40.880
<v Speaker 1>might be reliably relevant, and that was what was important

0:35:40.920 --> 0:35:44.360
<v Speaker 1>to Google and to Google's users. Again, it just needs

0:35:44.400 --> 0:35:48.279
<v Speaker 1>to be good enough. So the page rank algorithm was

0:35:48.400 --> 0:35:51.960
<v Speaker 1>using a pretty complex sorting method to determine which results

0:35:52.000 --> 0:35:55.840
<v Speaker 1>should be the most visible. You can, of course, page

0:35:55.880 --> 0:35:59.240
<v Speaker 1>through search results. You don't have to go with whichever

0:35:59.320 --> 0:36:03.319
<v Speaker 1>one's are on page one, And in theory, if you

0:36:03.480 --> 0:36:07.560
<v Speaker 1>keep on scrolling through, going to page after page after

0:36:07.600 --> 0:36:12.000
<v Speaker 1>page of search results, then over time you should see

0:36:12.040 --> 0:36:15.160
<v Speaker 1>that the results you're getting are not as relevant as

0:36:15.200 --> 0:36:18.520
<v Speaker 1>those that appeared earlier on the list, assuming everything is

0:36:18.520 --> 0:36:24.319
<v Speaker 1>working properly. Again, this doesn't always happen, but generally it's oh,

0:36:24.480 --> 0:36:28.839
<v Speaker 1>it holds true, and yeah, I'm drastically oversimplifying. You could

0:36:28.840 --> 0:36:33.080
<v Speaker 1>teach an entire computer science course on the page rink

0:36:33.120 --> 0:36:36.440
<v Speaker 1>algorithm and how it works. We're not going to do that.

0:36:36.560 --> 0:36:40.200
<v Speaker 1>I would just get it wrong anyway. Speaking of search, however,

0:36:40.480 --> 0:36:43.960
<v Speaker 1>let's talk about a much simpler form of search that's

0:36:44.000 --> 0:36:47.880
<v Speaker 1>based on a basic algorithm, and this is called binary search.

0:36:48.600 --> 0:36:51.120
<v Speaker 1>This is a process that's meant to decrease the amount

0:36:51.120 --> 0:36:54.280
<v Speaker 1>of time it takes to search for a specific value

0:36:54.880 --> 0:36:59.440
<v Speaker 1>within a sordid array of values. Alright, so let's say

0:36:59.440 --> 0:37:03.480
<v Speaker 1>that you've got a really big array or list of

0:37:03.840 --> 0:37:08.359
<v Speaker 1>entries right, and it's massive, and you're searching for a

0:37:08.440 --> 0:37:13.520
<v Speaker 1>specific target that has a specific value associated with it,

0:37:14.200 --> 0:37:19.160
<v Speaker 1>and a computer could go through this list item by item,

0:37:19.160 --> 0:37:22.399
<v Speaker 1>comparing it with your target right and look to see

0:37:22.440 --> 0:37:24.440
<v Speaker 1>if there's a match. If there's not a match, you

0:37:24.440 --> 0:37:26.480
<v Speaker 1>can go to the next item on the list and

0:37:26.560 --> 0:37:30.120
<v Speaker 1>do that. But if you're talking about a truly huge list,

0:37:30.320 --> 0:37:33.120
<v Speaker 1>this could take ages because if it happens to be

0:37:33.160 --> 0:37:34.680
<v Speaker 1>at the bottom of that list, you have to wait

0:37:34.719 --> 0:37:38.280
<v Speaker 1>for the computer to go through every single other entry

0:37:38.360 --> 0:37:43.000
<v Speaker 1>before it gets there. So a binary search cuts this short.

0:37:44.000 --> 0:37:48.360
<v Speaker 1>It takes a value that's in the middle of the array,

0:37:48.520 --> 0:37:52.280
<v Speaker 1>so like halfway down the list. Essentially it just pulls

0:37:52.360 --> 0:37:55.480
<v Speaker 1>that value and it compares it against your target, the

0:37:55.480 --> 0:37:58.759
<v Speaker 1>thing that you're searching for. And if the array is

0:37:58.800 --> 0:38:01.879
<v Speaker 1>a hundred thousand trees long, it's essentially looking at entry

0:38:01.960 --> 0:38:06.160
<v Speaker 1>number fifty thousand and one. It compares this to your search.

0:38:06.560 --> 0:38:09.839
<v Speaker 1>And let's say the value target of your of your

0:38:09.880 --> 0:38:14.600
<v Speaker 1>search query is lower than the entry that appeared at

0:38:14.640 --> 0:38:18.359
<v Speaker 1>fifty thousand and one. Well, now the binary search just

0:38:18.440 --> 0:38:22.560
<v Speaker 1>tosses everything that's fifty and one or higher on the

0:38:22.640 --> 0:38:25.040
<v Speaker 1>list because the values are only going to go up

0:38:25.080 --> 0:38:28.240
<v Speaker 1>from there, so it can get rid of half the list.

0:38:28.840 --> 0:38:33.120
<v Speaker 1>Right there, You're left with fifty thousand items in this array,

0:38:33.200 --> 0:38:37.000
<v Speaker 1>and the algorithm repeats this process. It goes for an

0:38:37.160 --> 0:38:40.320
<v Speaker 1>entry smack dab in the middle of the array, compares

0:38:40.360 --> 0:38:43.600
<v Speaker 1>it to the target. If the target's value is lower

0:38:44.200 --> 0:38:49.960
<v Speaker 1>than the middle entry of this array, then you you

0:38:50.040 --> 0:38:53.960
<v Speaker 1>dump everything that's at a higher number than that if

0:38:54.000 --> 0:38:57.040
<v Speaker 1>it's lower or its higher. Rather, if the target value

0:38:57.040 --> 0:38:59.279
<v Speaker 1>is higher than the middle entry, then you would get

0:38:59.360 --> 0:39:01.840
<v Speaker 1>rid of all the previous ones, like one through twenty

0:39:01.880 --> 0:39:05.000
<v Speaker 1>five thousand. For example, Let's say that you know your

0:39:05.040 --> 0:39:07.840
<v Speaker 1>your target value is higher than the middle entry of

0:39:07.880 --> 0:39:11.480
<v Speaker 1>twenty and one. It's gonna dump everything from one to

0:39:12.040 --> 0:39:15.040
<v Speaker 1>thousand and start over again and half it again again.

0:39:15.080 --> 0:39:17.960
<v Speaker 1>I'm kind of oversimplifying here, but the idea of binary

0:39:18.000 --> 0:39:21.080
<v Speaker 1>search is that rather than go through every single entry,

0:39:21.200 --> 0:39:25.360
<v Speaker 1>it keeps cutting this array in half, comparing it with

0:39:25.440 --> 0:39:29.080
<v Speaker 1>the target, and doing it again, which reduces the number

0:39:29.120 --> 0:39:33.200
<v Speaker 1>of times it takes to find the specific answer. Uh.

0:39:33.360 --> 0:39:35.640
<v Speaker 1>You might have thought of the like the the experiment

0:39:35.680 --> 0:39:39.680
<v Speaker 1>where you think about you're given two pennies on day

0:39:39.680 --> 0:39:42.440
<v Speaker 1>one and the next day, you're given four pennies or

0:39:42.480 --> 0:39:45.120
<v Speaker 1>cents if you prefer two cents. The next day you

0:39:45.120 --> 0:39:47.280
<v Speaker 1>get four cents. The next day you get eight cents,

0:39:47.320 --> 0:39:50.680
<v Speaker 1>and it doubles, and pretty quickly you see how that

0:39:50.800 --> 0:39:53.440
<v Speaker 1>doubling can actually start to amount to what we would consider,

0:39:53.600 --> 0:39:56.359
<v Speaker 1>you know, like quote unquote real money, same sort of thing.

0:39:56.400 --> 0:40:00.319
<v Speaker 1>By by having an array over and over again, you

0:40:00.520 --> 0:40:03.279
<v Speaker 1>very quickly whittle down the stuff you have to go

0:40:03.360 --> 0:40:05.759
<v Speaker 1>through and it speeds up the process of searching for

0:40:05.800 --> 0:40:11.720
<v Speaker 1>a specific value within a huge UH data list. Binary

0:40:11.760 --> 0:40:14.680
<v Speaker 1>search is just one form of search for for various

0:40:14.760 --> 0:40:18.600
<v Speaker 1>data constructs. There are lots of others. For example, there's

0:40:18.680 --> 0:40:23.200
<v Speaker 1>depth first search and breadth first search. I won't get

0:40:23.239 --> 0:40:25.960
<v Speaker 1>too deep into this but because it gets really technical,

0:40:26.040 --> 0:40:28.640
<v Speaker 1>but I can describe what's what's happening here from a

0:40:28.719 --> 0:40:32.800
<v Speaker 1>high level. So these search functions are used for data

0:40:32.840 --> 0:40:37.200
<v Speaker 1>structures that are that consists of nodes. And this is

0:40:37.239 --> 0:40:40.520
<v Speaker 1>easier to understand if we use an analogy, and I

0:40:40.560 --> 0:40:43.000
<v Speaker 1>want you to think of a choose your own adventure

0:40:43.160 --> 0:40:46.440
<v Speaker 1>book in case you're not familiar with those. These are

0:40:46.480 --> 0:40:49.120
<v Speaker 1>books where you would read a page and at the

0:40:49.200 --> 0:40:51.520
<v Speaker 1>end of the page, you would actually be given a choice,

0:40:51.600 --> 0:40:55.160
<v Speaker 1>like you could choose what the character you're reading about

0:40:55.160 --> 0:40:58.120
<v Speaker 1>would do next. So you might get to the end

0:40:58.160 --> 0:41:00.880
<v Speaker 1>of the first page of like a mystery book, and

0:41:01.360 --> 0:41:05.400
<v Speaker 1>the instruction might say, if you want your protagonists to

0:41:05.440 --> 0:41:08.279
<v Speaker 1>go down the hall, turn to page eight. If you

0:41:08.320 --> 0:41:11.359
<v Speaker 1>want her to shut a door and walk away, turn

0:41:11.440 --> 0:41:13.920
<v Speaker 1>to page twenty three, and you would make your choice,

0:41:13.960 --> 0:41:16.239
<v Speaker 1>turn to that page and continue the story that way.

0:41:16.320 --> 0:41:21.200
<v Speaker 1>And so the story branches, and you've got these branching pathways. Well.

0:41:21.239 --> 0:41:26.880
<v Speaker 1>Depth first and breadth first searches explore nodes in different ways.

0:41:27.000 --> 0:41:31.960
<v Speaker 1>A depth first search follows each branched path all the

0:41:32.000 --> 0:41:35.120
<v Speaker 1>way down from start to the end of that one branch,

0:41:35.719 --> 0:41:39.359
<v Speaker 1>before moving on to look at a different branch. So

0:41:39.400 --> 0:41:41.880
<v Speaker 1>in our example, would the Choose your Own Adventure book,

0:41:42.160 --> 0:41:45.239
<v Speaker 1>a depth first search would go to page eight to

0:41:45.400 --> 0:41:50.440
<v Speaker 1>follow your protagonists down the hall. Then whatever the options

0:41:50.440 --> 0:41:52.040
<v Speaker 1>were at the end of that, it would go with

0:41:52.080 --> 0:41:55.440
<v Speaker 1>the first option, continue and doing this all the time

0:41:55.760 --> 0:41:58.239
<v Speaker 1>until you get to the end of that pathway. Then

0:41:58.280 --> 0:42:01.040
<v Speaker 1>it would come back up to the next most recent branch,

0:42:01.160 --> 0:42:02.919
<v Speaker 1>follow that all the way to the end, and so

0:42:03.000 --> 0:42:07.279
<v Speaker 1>on until it had searched through every possible pathway in

0:42:07.360 --> 0:42:10.920
<v Speaker 1>this this uh this graph, that's what we would call it.

0:42:12.000 --> 0:42:17.920
<v Speaker 1>Breath search instead progresses equally across all possible paths. So

0:42:18.040 --> 0:42:21.920
<v Speaker 1>breath search would mean that you would go to page eight,

0:42:22.840 --> 0:42:24.759
<v Speaker 1>and let's say at the end of page eight, it

0:42:24.800 --> 0:42:27.560
<v Speaker 1>says you can then turn to page seventeen or page

0:42:27.560 --> 0:42:29.719
<v Speaker 1>fifty two to make your next choice. But instead of

0:42:29.760 --> 0:42:32.920
<v Speaker 1>continuing down that pathway, you back up to your starting

0:42:32.920 --> 0:42:35.720
<v Speaker 1>position and then you go down to page twenty three.

0:42:35.760 --> 0:42:37.520
<v Speaker 1>You know, the other option where you would close the

0:42:37.520 --> 0:42:40.120
<v Speaker 1>door and walk away. You would read that maybe at

0:42:40.120 --> 0:42:42.400
<v Speaker 1>the end of that page it says you can choose

0:42:42.400 --> 0:42:45.600
<v Speaker 1>to either go to page three or to page forty six. Well,

0:42:45.800 --> 0:42:48.160
<v Speaker 1>then you would go back to your your first branch.

0:42:48.200 --> 0:42:52.640
<v Speaker 1>You would go down the list of pages seventeen and

0:42:52.719 --> 0:42:55.960
<v Speaker 1>fifty two and three and forty six, maybe those all

0:42:56.040 --> 0:42:59.040
<v Speaker 1>end in different choices. You would then do all of

0:42:59.040 --> 0:43:01.680
<v Speaker 1>those across the board. Next you're you're searching across the

0:43:01.760 --> 0:43:06.200
<v Speaker 1>width of the graph the breadth of it. Both are

0:43:06.320 --> 0:43:09.760
<v Speaker 1>valid forms of searching, and the method used typically depends

0:43:09.840 --> 0:43:12.239
<v Speaker 1>upon the type of data being searched and what you're

0:43:12.239 --> 0:43:15.040
<v Speaker 1>trying to do. We've got a lot more to cover

0:43:15.080 --> 0:43:19.000
<v Speaker 1>with algorithms, but I feel like I'm gonna have to

0:43:19.080 --> 0:43:23.080
<v Speaker 1>give you guys a break, So let's do that really quick,

0:43:23.160 --> 0:43:26.680
<v Speaker 1>and I'll just give you a very short example following,

0:43:27.200 --> 0:43:29.760
<v Speaker 1>and then we'll pick up back up with algorithms again

0:43:29.840 --> 0:43:32.400
<v Speaker 1>in a future episode. But first let's take this quick break,

0:43:33.040 --> 0:43:43.279
<v Speaker 1>all right. I know I've waxed poetic about algorithms so

0:43:43.360 --> 0:43:46.399
<v Speaker 1>much so that this episode is running longer than I anticipated.

0:43:46.440 --> 0:43:52.640
<v Speaker 1>I have a whole extra section to talk about with algorithms,

0:43:52.640 --> 0:43:56.040
<v Speaker 1>including things that are related to algorithms but aren't necessarily

0:43:56.160 --> 0:44:00.520
<v Speaker 1>specifically algorithms, stuff like hashing and Markov models and things

0:44:00.560 --> 0:44:03.600
<v Speaker 1>of that nature. But I want to finish up with

0:44:03.680 --> 0:44:06.239
<v Speaker 1>one that I think is kind of fun. And this

0:44:06.320 --> 0:44:09.479
<v Speaker 1>is called the Doomsday rule. And to be be fair,

0:44:09.560 --> 0:44:12.200
<v Speaker 1>this is not just a computational algorithm. This is something

0:44:12.239 --> 0:44:14.440
<v Speaker 1>that you can do in your head if you learn

0:44:14.560 --> 0:44:16.960
<v Speaker 1>the rule. I'm not saying I could do it. I

0:44:16.960 --> 0:44:21.319
<v Speaker 1>haven't really committed this to a memory process yet, but

0:44:21.400 --> 0:44:26.000
<v Speaker 1>it is possible. And the Doomsday rule sounds pretty ominous, however, right.

0:44:26.120 --> 0:44:29.400
<v Speaker 1>I mean, it's basically to figure out what day of

0:44:29.440 --> 0:44:33.839
<v Speaker 1>the week any given date is So if you were

0:44:33.880 --> 0:44:36.880
<v Speaker 1>an expert with the doomsday rule and I asked you, hey,

0:44:37.080 --> 0:44:41.279
<v Speaker 1>what day of the week does June five fall on?

0:44:41.920 --> 0:44:44.160
<v Speaker 1>You could use that rule and say, oh, that's gonna

0:44:44.160 --> 0:44:46.920
<v Speaker 1>be a Thursday. That also, by the way, happens to

0:44:46.920 --> 0:44:50.399
<v Speaker 1>be the day I'll turn fifty. Yikes, man, we're coming

0:44:50.440 --> 0:44:53.400
<v Speaker 1>up on that one. All right, So where did this

0:44:53.560 --> 0:44:56.520
<v Speaker 1>rule come from? And what the heck is this doomsday

0:44:56.520 --> 0:44:59.080
<v Speaker 1>stuff about? Well, the doomsday thing is kind of just

0:44:59.120 --> 0:45:02.520
<v Speaker 1>a cheeky name, and there's all these different ways we

0:45:02.520 --> 0:45:06.920
<v Speaker 1>could describe that. But during any given year, there are

0:45:07.000 --> 0:45:09.879
<v Speaker 1>certain dates that will always share the same day of

0:45:09.920 --> 0:45:12.160
<v Speaker 1>the week, which is no big surprise, right. I mean,

0:45:12.719 --> 0:45:17.120
<v Speaker 1>you might notice that Christmas, that is December, falls on

0:45:17.160 --> 0:45:19.680
<v Speaker 1>the same day of the week as New Year's Day

0:45:19.880 --> 0:45:22.439
<v Speaker 1>for the following year that happened, you know, January one.

0:45:22.480 --> 0:45:26.040
<v Speaker 1>It always is that way. But with the doomsday rule,

0:45:26.600 --> 0:45:31.120
<v Speaker 1>the dates for that are called doomsdays. Are things like

0:45:31.239 --> 0:45:36.040
<v Speaker 1>April four or four four, June six that's six six,

0:45:36.520 --> 0:45:40.160
<v Speaker 1>August eight that's eight eight, and you know, so on

0:45:40.200 --> 0:45:46.000
<v Speaker 1>like October tenth, that's ten ten. The anchor day are

0:45:46.080 --> 0:45:51.200
<v Speaker 1>called these are anchor days. They're called doomsdays, um they

0:45:51.280 --> 0:45:55.200
<v Speaker 1>change with each year or with leap years. The anchor

0:45:55.280 --> 0:45:58.759
<v Speaker 1>day actually leaps a year, but once you know that day,

0:45:58.920 --> 0:46:01.120
<v Speaker 1>you know it's the same for all of those dates.

0:46:01.440 --> 0:46:07.120
<v Speaker 1>So for one, as I record this, this year's doomsday

0:46:07.440 --> 0:46:10.160
<v Speaker 1>is or anchor day is a Sunday. So that means

0:46:10.200 --> 0:46:12.520
<v Speaker 1>every Doomsday is going to be a Sunday. So I'm

0:46:12.520 --> 0:46:17.600
<v Speaker 1>recording this in July with our next doomsday being on

0:46:17.760 --> 0:46:23.640
<v Speaker 1>August eight, so that means August eight should be a Sunday.

0:46:23.680 --> 0:46:26.399
<v Speaker 1>And if you look at the calendar, you'll see that yes,

0:46:26.560 --> 0:46:30.160
<v Speaker 1>August day is a Sunday. That means that October ten

0:46:30.560 --> 0:46:35.200
<v Speaker 1>should be a Sunday, that December twelve should be a Sunday.

0:46:35.280 --> 0:46:37.600
<v Speaker 1>So the doomsday rule involves a little bit more than

0:46:37.680 --> 0:46:40.960
<v Speaker 1>just this, but not much more. And this means that

0:46:41.120 --> 0:46:44.319
<v Speaker 1>if you learn the doomsday rule and you have a

0:46:44.360 --> 0:46:48.560
<v Speaker 1>general idea of what the anchor day is for each year,

0:46:49.120 --> 0:46:52.319
<v Speaker 1>you can calculate what in what day of the week

0:46:52.560 --> 0:46:57.239
<v Speaker 1>any given date will fall on, including past years. The

0:46:57.239 --> 0:47:00.000
<v Speaker 1>guy who came up with this was a mathematician named

0:47:00.239 --> 0:47:04.360
<v Speaker 1>John Conway, and reportedly he could give you an answer

0:47:04.440 --> 0:47:06.560
<v Speaker 1>in less than two seconds if you gave him a date,

0:47:06.600 --> 0:47:08.080
<v Speaker 1>he could tell you what day of the week it

0:47:08.120 --> 0:47:11.760
<v Speaker 1>was going to fall on in two seconds or less. Sadly,

0:47:11.840 --> 0:47:15.239
<v Speaker 1>he passed away last year at the age of eighty

0:47:15.280 --> 0:47:20.000
<v Speaker 1>two after he contracted COVID nineteen. But that doomsday rule

0:47:20.080 --> 0:47:21.799
<v Speaker 1>is one that I think is super cool. I've seen

0:47:21.840 --> 0:47:23.600
<v Speaker 1>people who can do this where you give them a

0:47:23.680 --> 0:47:25.719
<v Speaker 1>date and they're just able to tell you what day

0:47:25.719 --> 0:47:28.120
<v Speaker 1>of the week that falls on, and you can go

0:47:28.160 --> 0:47:30.520
<v Speaker 1>and check it and sure enough they're right. Well, this

0:47:30.600 --> 0:47:33.239
<v Speaker 1>is one process where you can do that. It's not

0:47:33.280 --> 0:47:35.960
<v Speaker 1>the only one, by the way, there are other algorithms

0:47:36.040 --> 0:47:39.360
<v Speaker 1>that also can help you determine what day of the

0:47:39.400 --> 0:47:42.680
<v Speaker 1>week a specific date will fall on. But the doomsday

0:47:42.760 --> 0:47:46.000
<v Speaker 1>rule is is one that works. And again I don't

0:47:46.040 --> 0:47:49.040
<v Speaker 1>have it, um. I don't have an expertise in this.

0:47:49.200 --> 0:47:51.759
<v Speaker 1>I haven't practiced it at all, so I can't do it.

0:47:52.239 --> 0:47:53.840
<v Speaker 1>If you came up to me and say, hey, Jonathan

0:47:54.400 --> 0:47:57.640
<v Speaker 1>May first, nineteen, what day of the week was that,

0:47:57.680 --> 0:48:01.279
<v Speaker 1>I'd be like, I don't know. Probably really a it's

0:48:01.320 --> 0:48:04.840
<v Speaker 1>probably a fine day. I don't I don't know because

0:48:04.840 --> 0:48:07.240
<v Speaker 1>I haven't done this yet. But I think it's really cool.

0:48:07.280 --> 0:48:10.960
<v Speaker 1>I gets. It illustrates how for certain types of problems

0:48:11.360 --> 0:48:14.560
<v Speaker 1>you can come up with a mathematical approach to solving

0:48:14.560 --> 0:48:18.600
<v Speaker 1>those problems, and it just is applicable for all problems

0:48:18.640 --> 0:48:21.880
<v Speaker 1>that fall into that category. And that's really the elegant

0:48:21.920 --> 0:48:24.439
<v Speaker 1>and cool thing about algorithms. Also the other cool things

0:48:24.520 --> 0:48:26.960
<v Speaker 1>that people are coming up with new ones all the time,

0:48:27.719 --> 0:48:31.120
<v Speaker 1>and they might be trying to refine earlier algorithms to

0:48:31.200 --> 0:48:34.400
<v Speaker 1>make them even more efficient and effective, or they might

0:48:34.400 --> 0:48:36.279
<v Speaker 1>be trying to come up with all new algorithms to

0:48:36.320 --> 0:48:41.320
<v Speaker 1>take advantage of emerging technology stuff like quantum computing. I

0:48:41.400 --> 0:48:44.560
<v Speaker 1>hope you enjoyed that episode. Like I said, it originally

0:48:44.560 --> 0:48:48.080
<v Speaker 1>published last year in two thousand twenty one, and hopefully

0:48:48.160 --> 0:48:51.239
<v Speaker 1>tomorrow I'll be back in shape and I'll be able

0:48:51.280 --> 0:48:54.920
<v Speaker 1>to do another news episode. We'll have to wait and see.

0:48:55.040 --> 0:48:56.799
<v Speaker 1>Like I said, I'm really hoping that this is just

0:48:57.400 --> 0:49:00.120
<v Speaker 1>a stomach bug thing that I'm dealing with and not

0:49:00.400 --> 0:49:04.120
<v Speaker 1>like round two of COVID. I do have a test

0:49:04.280 --> 0:49:06.480
<v Speaker 1>that literally I think just arrived at my door, so

0:49:06.560 --> 0:49:08.879
<v Speaker 1>I will check and make sure, because obviously I want

0:49:08.880 --> 0:49:11.200
<v Speaker 1>to be responsible and safe for all of my fellow

0:49:11.280 --> 0:49:13.920
<v Speaker 1>human beings. Out there. I hope all of you are

0:49:13.920 --> 0:49:17.080
<v Speaker 1>well and staying safe and healthy, and that you're having

0:49:17.360 --> 0:49:20.839
<v Speaker 1>a great summer so far. Uh you know, I plan

0:49:20.880 --> 0:49:24.040
<v Speaker 1>on having a great summer once I feel better. For now,

0:49:24.120 --> 0:49:27.719
<v Speaker 1>I'm just having a kind of grouchy summer because that's

0:49:27.920 --> 0:49:29.839
<v Speaker 1>I mean, that's my go to mood for pretty much

0:49:29.920 --> 0:49:33.680
<v Speaker 1>any situation, but particularly when I'm not feeling well. Anyway,

0:49:34.239 --> 0:49:37.680
<v Speaker 1>take care and I will talk to you again really soon.

0:49:43.560 --> 0:49:46.600
<v Speaker 1>Text Stuff is an I Heart Radio production. For more

0:49:46.680 --> 0:49:50.040
<v Speaker 1>podcasts from my Heart Radio, visit the i Heart Radio app,

0:49:50.200 --> 0:49:53.320
<v Speaker 1>Apple Podcasts, or wherever you listen to your favorite shows.