WEBVTT - 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:12.119 --> 0:00:14.920
<v Speaker 1>Hey there, and welcome to tech Stuff. I'm your host,

0:00:15.080 --> 0:00:18.000
<v Speaker 1>Jonathan Strickland. I'm an executive producer with I Heart Radio

0:00:18.079 --> 0:00:21.600
<v Speaker 1>and a love of all things tech, and I frequently

0:00:21.840 --> 0:00:25.600
<v Speaker 1>speak about algorithms on this show. I talked about them

0:00:25.640 --> 0:00:30.120
<v Speaker 1>all the time, talk about Facebook's algorithm or YouTube's algorithm.

0:00:30.240 --> 0:00:34.440
<v Speaker 1>We talk about search algorithms and recommendation algorithms and tons

0:00:34.680 --> 0:00:37.800
<v Speaker 1>of others. But I haven't really spent a ton of

0:00:37.840 --> 0:00:42.760
<v Speaker 1>time talking about what algorithms actually are. Like it kind

0:00:42.760 --> 0:00:47.519
<v Speaker 1>of becomes shorthand for do not look behind the curtain, right,

0:00:47.680 --> 0:00:49.959
<v Speaker 1>It doesn't really help you if you don't know more

0:00:50.080 --> 0:00:53.160
<v Speaker 1>about it. I might go as far as to say

0:00:53.200 --> 0:00:55.680
<v Speaker 1>it's a set of rules or instructions to carry out

0:00:55.680 --> 0:00:59.120
<v Speaker 1>a task, but that's pretty reductive and it doesn't really

0:00:59.160 --> 0:01:02.280
<v Speaker 1>help you understand and what algorithms actually do. So today

0:01:02.800 --> 0:01:05.640
<v Speaker 1>I thought we'd talk a little bit about algorithms and

0:01:05.720 --> 0:01:08.360
<v Speaker 1>what they do in general, and then maybe chat about

0:01:08.360 --> 0:01:11.600
<v Speaker 1>a few famous examples and some fun, little quirky stuff.

0:01:11.680 --> 0:01:15.480
<v Speaker 1>So before I dive into this, we do need to

0:01:15.600 --> 0:01:20.759
<v Speaker 1>establish a few things, and arguably the most important of

0:01:20.800 --> 0:01:24.360
<v Speaker 1>those things is that I am not a mathematician, I

0:01:24.400 --> 0:01:28.120
<v Speaker 1>am not a computer scientist. I'm a guy who loves tech,

0:01:28.520 --> 0:01:32.279
<v Speaker 1>and I'm decent at research, and I do my best

0:01:32.360 --> 0:01:36.480
<v Speaker 1>to communicate topics in an informative and you know, on

0:01:36.520 --> 0:01:39.839
<v Speaker 1>a good day and entertaining way. So with that in mind,

0:01:40.280 --> 0:01:43.000
<v Speaker 1>I fully admit that this is a subject that is

0:01:43.040 --> 0:01:48.160
<v Speaker 1>outside of my narrow expertise, and so my descriptions and

0:01:48.240 --> 0:01:52.800
<v Speaker 1>explanations will be from a very high level. And you

0:01:52.880 --> 0:01:55.560
<v Speaker 1>might even be able to get something like this just

0:01:55.640 --> 0:01:59.480
<v Speaker 1>by glancing at a pamphlet that's about a computer science

0:01:59.520 --> 0:02:04.280
<v Speaker 1>introduct the recourse. So for all you folks out there

0:02:04.280 --> 0:02:06.480
<v Speaker 1>who are deep in the computer sciences, this is going

0:02:06.520 --> 0:02:10.760
<v Speaker 1>to be like a children's story book for you, possibly

0:02:10.880 --> 0:02:15.520
<v Speaker 1>one where you don't like the illustrations very much. Another

0:02:15.600 --> 0:02:19.600
<v Speaker 1>thing that I need to establish is that algorithm itself

0:02:19.680 --> 0:02:23.560
<v Speaker 1>is a very broad term, you know, in that sense

0:02:23.680 --> 0:02:28.079
<v Speaker 1>it's kind of like the word program or app or software,

0:02:28.639 --> 0:02:32.040
<v Speaker 1>and that these words are categories that can have a

0:02:32.080 --> 0:02:36.320
<v Speaker 1>wide variety of specific instances. For example, let's just take

0:02:36.320 --> 0:02:39.040
<v Speaker 1>a look at software. If I'm talking about software, I

0:02:39.040 --> 0:02:43.240
<v Speaker 1>could be talking about a very simple program that serves

0:02:43.360 --> 0:02:47.520
<v Speaker 1>as a basic calculator that can add and subtract and

0:02:47.520 --> 0:02:51.160
<v Speaker 1>divide and multiply. That could be a piece of software,

0:02:51.240 --> 0:02:53.919
<v Speaker 1>be a very simple one, or I might talk about

0:02:53.960 --> 0:02:57.760
<v Speaker 1>something a little more complicated, like a word processing program.

0:02:57.919 --> 0:03:01.240
<v Speaker 1>Or I could talk about an advanced three D shooter

0:03:01.480 --> 0:03:07.720
<v Speaker 1>video game, or an incredibly complicated computer simulation program, or

0:03:07.760 --> 0:03:10.240
<v Speaker 1>anything in between. All of those could fall into the

0:03:10.280 --> 0:03:14.760
<v Speaker 1>realm of software well. Algorithms similarly come in a wide

0:03:14.840 --> 0:03:19.000
<v Speaker 1>variety of functions and complexity. There are some that are

0:03:19.000 --> 0:03:23.119
<v Speaker 1>elegant in their simplicity, and there are some that when

0:03:23.120 --> 0:03:26.000
<v Speaker 1>I look at them written out in in what is

0:03:26.320 --> 0:03:33.600
<v Speaker 1>clearly well defined terminology, uh, I'm just left wondering what

0:03:33.639 --> 0:03:35.600
<v Speaker 1>the heck it is I just saw. They might as

0:03:35.600 --> 0:03:38.680
<v Speaker 1>well be hieroglyphics to me. In other words, But let's

0:03:38.680 --> 0:03:43.400
<v Speaker 1>start off by talking about the word algorithm itself. Now,

0:03:44.640 --> 0:03:48.720
<v Speaker 1>unlike a lot of words that we use specifically in English,

0:03:49.240 --> 0:03:53.920
<v Speaker 1>algorithm does not have its roots in Latin vocabulary. There

0:03:53.960 --> 0:03:57.400
<v Speaker 1>are words in Latin that are like al gore and

0:03:57.480 --> 0:04:01.040
<v Speaker 1>things like that, but that's not where algorithm comes from. Instead,

0:04:01.720 --> 0:04:07.600
<v Speaker 1>it's a latinized version of an Arabic name. Algorithm comes

0:04:07.600 --> 0:04:10.920
<v Speaker 1>from algorithmic, which is the name that Latin scholars gave

0:04:10.960 --> 0:04:15.160
<v Speaker 1>to a brilliant man named al qua Ritzmy and my

0:04:15.320 --> 0:04:19.000
<v Speaker 1>apologies for the butchering of the pronunciation of that name.

0:04:19.200 --> 0:04:24.840
<v Speaker 1>No disrespect is intended. It's merely American ignorance. Anyway. This

0:04:24.960 --> 0:04:31.719
<v Speaker 1>particular mathematician philosophers scholar served as a very important astronomer

0:04:31.760 --> 0:04:36.200
<v Speaker 1>and librarian in Baghdad in the ninth century. His work

0:04:36.240 --> 0:04:40.479
<v Speaker 1>in mathematics was truly foundational, so much so that we

0:04:40.600 --> 0:04:44.680
<v Speaker 1>get the word algebra from a work that he published.

0:04:45.320 --> 0:04:49.440
<v Speaker 1>He treated algebra as a distinct branch of mathematics, when

0:04:49.520 --> 0:04:51.799
<v Speaker 1>before it was just kind of lumped in with other stuff.

0:04:52.160 --> 0:04:54.360
<v Speaker 1>And he did a lot of work in showing how

0:04:54.440 --> 0:04:58.400
<v Speaker 1>to work various types of equations and how to balance equations.

0:04:58.600 --> 0:05:02.039
<v Speaker 1>And on a personal note, this was something that I

0:05:02.160 --> 0:05:04.800
<v Speaker 1>used to love to do in my mathematics courses. I

0:05:04.839 --> 0:05:08.279
<v Speaker 1>could really see the beauty in determining if two sides

0:05:08.320 --> 0:05:11.960
<v Speaker 1>of an equation truly were equal. It was like an

0:05:12.000 --> 0:05:15.240
<v Speaker 1>elegant puzzle and I really love that. But again, just

0:05:15.279 --> 0:05:18.000
<v Speaker 1>to be clear, my love of algebra and trigonometry is

0:05:18.040 --> 0:05:21.240
<v Speaker 1>pretty much where math and I parted ways, because when

0:05:21.279 --> 0:05:25.080
<v Speaker 1>calculus came along, I was I was pretty much done,

0:05:25.160 --> 0:05:27.640
<v Speaker 1>so at that point it was it was beyond my

0:05:27.880 --> 0:05:33.080
<v Speaker 1>ken as they say. Anyway, back to our Arabic scholar,

0:05:33.520 --> 0:05:38.000
<v Speaker 1>he highlighted the importance and effectiveness of using a methodical

0:05:38.160 --> 0:05:42.760
<v Speaker 1>approach towards the solution of problems, and that kind of

0:05:42.800 --> 0:05:47.440
<v Speaker 1>gets at the heart of what algorithms actually are. The

0:05:47.480 --> 0:05:51.240
<v Speaker 1>basic definition, which I kind of alluded to earlier is

0:05:51.480 --> 0:05:55.400
<v Speaker 1>quote a process or set of rules to be followed

0:05:55.480 --> 0:06:00.640
<v Speaker 1>in calculations or other problems solving operations, especially by a

0:06:00.640 --> 0:06:05.080
<v Speaker 1>computer end quote that's from Oxford Languages. But you know

0:06:05.480 --> 0:06:07.560
<v Speaker 1>this can apply to all sorts of stuff. For example,

0:06:07.760 --> 0:06:11.719
<v Speaker 1>if you've ever seen anyone who can solve Rubik's cubes,

0:06:12.160 --> 0:06:15.040
<v Speaker 1>those those puzzles that are in cube form where you've

0:06:15.040 --> 0:06:17.760
<v Speaker 1>got all the little, uh different colors of squares and

0:06:17.800 --> 0:06:20.440
<v Speaker 1>your job is to make each side of the cube

0:06:20.480 --> 0:06:24.080
<v Speaker 1>the same color. Well, there are people who can solve

0:06:24.160 --> 0:06:27.800
<v Speaker 1>Rubik's cubes in in in a fraction of like, like

0:06:28.000 --> 0:06:30.359
<v Speaker 1>less than a minute. It's it's amazing to watch them go.

0:06:30.480 --> 0:06:33.400
<v Speaker 1>It's so fast and it's hard to keep up with

0:06:33.400 --> 0:06:39.080
<v Speaker 1>what they're doing. They are essentially following algorithms these processes

0:06:39.200 --> 0:06:45.799
<v Speaker 1>that will get to a dependable and replicable outcome based

0:06:45.839 --> 0:06:49.120
<v Speaker 1>on what you're doing. Um So, an algorithm is really

0:06:49.160 --> 0:06:52.279
<v Speaker 1>just a way for us to problem solve. Let's say

0:06:52.279 --> 0:06:54.920
<v Speaker 1>we have a particular outcome that we want to achieve.

0:06:55.240 --> 0:06:58.320
<v Speaker 1>The algorithm is the recipe that we followed to go

0:06:58.440 --> 0:07:01.320
<v Speaker 1>from whatever our starting can to. S is our starting

0:07:01.360 --> 0:07:04.680
<v Speaker 1>state in order to get to the outcome we want

0:07:04.680 --> 0:07:08.640
<v Speaker 1>to our target state, it needs to be well defined.

0:07:08.920 --> 0:07:11.280
<v Speaker 1>Algorithms have to be well defined because computers are not

0:07:11.320 --> 0:07:15.960
<v Speaker 1>really capable of implementing vague instructions. It needs to have

0:07:16.800 --> 0:07:19.600
<v Speaker 1>a pretty solid approach so that the computer, when following

0:07:19.640 --> 0:07:23.280
<v Speaker 1>the algorithm quote unquote, knows exactly what to do based

0:07:23.320 --> 0:07:26.880
<v Speaker 1>upon the current state of the problem. It also needs

0:07:26.880 --> 0:07:32.320
<v Speaker 1>to be finite. Computers are not capable of handling infinite possibilities,

0:07:32.800 --> 0:07:36.080
<v Speaker 1>so the algorithm has to work within certain parameters, and

0:07:36.160 --> 0:07:39.240
<v Speaker 1>those parameters depend upon the nature of the problem you're

0:07:39.280 --> 0:07:42.080
<v Speaker 1>trying to solve and the equipment that you have to

0:07:42.160 --> 0:07:46.200
<v Speaker 1>solve it with. So let's take a problem that computers

0:07:46.320 --> 0:07:51.360
<v Speaker 1>typically struggle to achieve, and that is random number generation

0:07:51.680 --> 0:07:55.200
<v Speaker 1>or r n G. Now, you would think that creating

0:07:55.240 --> 0:07:58.680
<v Speaker 1>a random number would be easy. I mean, we can

0:07:58.720 --> 0:08:01.880
<v Speaker 1>do it just by throwing some dice for example, Right,

0:08:01.920 --> 0:08:04.280
<v Speaker 1>you can throw a die and and whatever the number

0:08:04.560 --> 0:08:08.360
<v Speaker 1>comes up, that's your random number. But computers have to

0:08:08.400 --> 0:08:13.600
<v Speaker 1>follow specific instructions and execute operations that by definition need

0:08:13.640 --> 0:08:17.400
<v Speaker 1>to have a predictable and replicable outcomes. So computers find

0:08:17.480 --> 0:08:22.480
<v Speaker 1>random number generation really tricky. Typically, the best we can

0:08:22.520 --> 0:08:25.560
<v Speaker 1>hope for when it comes down to this sort of

0:08:25.600 --> 0:08:29.640
<v Speaker 1>thing is pseudo random numbers. So these are numbers that,

0:08:29.760 --> 0:08:33.480
<v Speaker 1>to an extent, appear to be random, right Like, on

0:08:33.720 --> 0:08:38.920
<v Speaker 1>casual observation, it looks like the computer is generating random numbers. However,

0:08:38.960 --> 0:08:42.720
<v Speaker 1>if you were to really seriously dig down into the process,

0:08:43.160 --> 0:08:46.480
<v Speaker 1>you might discover that they are not really random at all.

0:08:47.120 --> 0:08:49.760
<v Speaker 1>But we just need them to be random enough, right.

0:08:49.840 --> 0:08:52.720
<v Speaker 1>We need it to be close enough to seeming to

0:08:52.760 --> 0:08:55.400
<v Speaker 1>be random for it to fulfill the function we need.

0:08:55.880 --> 0:08:59.000
<v Speaker 1>If it's not truly random for a lot of applications,

0:08:59.559 --> 0:09:04.320
<v Speaker 1>that ends being you know, negligible. On a related note,

0:09:04.720 --> 0:09:07.960
<v Speaker 1>there are some types of mathematical problems that have many

0:09:07.960 --> 0:09:12.280
<v Speaker 1>degrees of freedom lots of variables. For example, so a

0:09:12.360 --> 0:09:14.360
<v Speaker 1>problem that does have a lot of variables could have

0:09:14.360 --> 0:09:16.959
<v Speaker 1>a lot of potential solutions, and so it could be

0:09:17.000 --> 0:09:20.480
<v Speaker 1>a challenge for computers to solve. We need algorithms to

0:09:20.480 --> 0:09:24.040
<v Speaker 1>tackle these sorts of problems, to go at them in

0:09:24.080 --> 0:09:29.240
<v Speaker 1>ways that go beyond deterministic computation, which I guess I

0:09:29.280 --> 0:09:34.160
<v Speaker 1>should define that. So, deterministic computation refers to a process

0:09:34.200 --> 0:09:39.000
<v Speaker 1>in which each successive state of an operation depends completely

0:09:39.080 --> 0:09:43.640
<v Speaker 1>on the previous state. So what comes next always depends

0:09:43.720 --> 0:09:47.120
<v Speaker 1>upon what came just before. And I'll give you an example.

0:09:47.440 --> 0:09:49.480
<v Speaker 1>Let's say I give you a math problem. I say

0:09:49.960 --> 0:09:52.000
<v Speaker 1>you need to add these two numbers together. And let's

0:09:52.000 --> 0:09:55.839
<v Speaker 1>say it's like, uh, five and six, and then from

0:09:55.960 --> 0:09:59.040
<v Speaker 1>the sum of those numbers you have to subtract four. Well,

0:09:59.280 --> 0:10:01.960
<v Speaker 1>you at first add those two numbers together, so five

0:10:02.000 --> 0:10:05.160
<v Speaker 1>plus six you got eleven, and then you would subtract

0:10:05.679 --> 0:10:10.240
<v Speaker 1>four from that number, and so eleven minus four equals seven.

0:10:10.840 --> 0:10:14.160
<v Speaker 1>And this process is deterministic, because I gave you those

0:10:14.160 --> 0:10:19.600
<v Speaker 1>specific instructions that computers do really well with deterministic processes.

0:10:19.679 --> 0:10:23.440
<v Speaker 1>These are pretty easy to follow. These sorts of processes

0:10:23.480 --> 0:10:27.160
<v Speaker 1>are by their nature replicable. So in other words, if

0:10:27.200 --> 0:10:30.240
<v Speaker 1>I ask you to do that same operation. If I

0:10:30.280 --> 0:10:33.520
<v Speaker 1>tell you add five and six together and then subtract four,

0:10:34.360 --> 0:10:36.400
<v Speaker 1>it doesn't matter how many times you are you do

0:10:36.520 --> 0:10:38.959
<v Speaker 1>that that process, right, You're always going to come out

0:10:39.559 --> 0:10:41.840
<v Speaker 1>with the same answer. It's always going to come back

0:10:42.200 --> 0:10:45.680
<v Speaker 1>no matter what you do, You're gonna always have seven

0:10:45.760 --> 0:10:49.480
<v Speaker 1>as your answer, just based on that same input. So

0:10:49.840 --> 0:10:53.840
<v Speaker 1>there are a family of algorithms that collectively get the

0:10:53.920 --> 0:10:58.680
<v Speaker 1>name Monte Carlo algorithms, and they're named after Monte Carlo,

0:10:58.920 --> 0:11:01.400
<v Speaker 1>the area of Monaco that is famous for being the

0:11:01.440 --> 0:11:05.480
<v Speaker 1>location of lots of high end casinos have been there.

0:11:05.960 --> 0:11:09.680
<v Speaker 1>It's not really my jam, but it is pretty darn flashy.

0:11:10.240 --> 0:11:14.559
<v Speaker 1>So the reason these algorithms get the name Monte Carlo

0:11:14.640 --> 0:11:19.400
<v Speaker 1>algorithms is that, like gambling, they deal with an element

0:11:19.480 --> 0:11:24.680
<v Speaker 1>of randomization. So gambling is called gambling because you're taking

0:11:24.679 --> 0:11:28.760
<v Speaker 1>a risk. You're gambling, you're betting that you're gonna beat

0:11:28.800 --> 0:11:31.400
<v Speaker 1>the odds in whichever game it is that you're playing,

0:11:31.520 --> 0:11:34.439
<v Speaker 1>and that you're going to achieve an outcome that's favorable

0:11:34.480 --> 0:11:38.120
<v Speaker 1>to you, which you experience as a payout. So whether

0:11:38.160 --> 0:11:41.720
<v Speaker 1>it's throwing dice or playing a card game or placing

0:11:41.720 --> 0:11:45.200
<v Speaker 1>bets at a roulette wheel or playing a slot machine.

0:11:45.280 --> 0:11:47.880
<v Speaker 1>You are engaged in an activity in which there is

0:11:48.080 --> 0:11:51.800
<v Speaker 1>some element of chance, at least in theory if the

0:11:51.800 --> 0:11:55.000
<v Speaker 1>game is honest, and what you're hoping for is that

0:11:55.400 --> 0:12:00.280
<v Speaker 1>chance lands in your favor. Similarly, Monty car are Low

0:12:00.360 --> 0:12:04.440
<v Speaker 1>algorithms often focus on chance and risk assessments such as

0:12:04.880 --> 0:12:08.200
<v Speaker 1>what are the odds that if I do this one thing,

0:12:08.840 --> 0:12:12.480
<v Speaker 1>I'm gonna totally regret doing it later? But you know,

0:12:12.640 --> 0:12:15.320
<v Speaker 1>more of the as a computational problem and not a

0:12:15.400 --> 0:12:20.959
<v Speaker 1>lifestyle choice. Well, back in nineteen scientists at the Los

0:12:21.040 --> 0:12:25.920
<v Speaker 1>Alamos Scientific Laboratory, including John von Neumann, uh stand All

0:12:26.200 --> 0:12:30.240
<v Speaker 1>Lam and Nick Metropolis, proposed what would become known as

0:12:30.240 --> 0:12:34.960
<v Speaker 1>the Metropolis algorithm, one of the Monte Carlo algorithms, and

0:12:35.000 --> 0:12:39.199
<v Speaker 1>the purpose of this algorithm was to approximate solutions two

0:12:39.440 --> 0:12:45.559
<v Speaker 1>very complicated mathematical problems where going through a deterministic approach

0:12:45.880 --> 0:12:49.640
<v Speaker 1>to find the definitive answer just wasn't feasible. So, in

0:12:49.679 --> 0:12:53.160
<v Speaker 1>other words, for certain complicated math problems, figuring out the

0:12:53.200 --> 0:12:56.839
<v Speaker 1>quote unquote real answer would really just take too long,

0:12:57.240 --> 0:12:59.480
<v Speaker 1>perhaps to the point where you would never get there

0:12:59.480 --> 0:13:02.240
<v Speaker 1>within your lifetime. So you need a way to kind

0:13:02.280 --> 0:13:05.959
<v Speaker 1>of get a ballpark solution that hopefully is closer to

0:13:06.000 --> 0:13:09.720
<v Speaker 1>being correct than incorrect. Doesn't sound like the sort of

0:13:09.720 --> 0:13:12.080
<v Speaker 1>thing that computers would be particularly good at doing right

0:13:12.120 --> 0:13:15.960
<v Speaker 1>off the bat. Right. In fact, the algorithm allows computers

0:13:16.000 --> 0:13:20.320
<v Speaker 1>to mimic a randomized process, so it's not truly random,

0:13:20.520 --> 0:13:24.120
<v Speaker 1>but it's random ish if you like, And it uses

0:13:24.160 --> 0:13:27.320
<v Speaker 1>this to approximate a solution to whatever the problem is

0:13:27.360 --> 0:13:30.440
<v Speaker 1>that you're trying to solve that falls into this category.

0:13:30.600 --> 0:13:34.320
<v Speaker 1>I once saw a simulation of a randomized process using

0:13:34.320 --> 0:13:38.640
<v Speaker 1>the Monte Carlo method that I thought was pretty nifty,

0:13:38.760 --> 0:13:41.560
<v Speaker 1>and it was determining what is the value of pie.

0:13:41.679 --> 0:13:44.840
<v Speaker 1>Let's say that you don't know the value of pie

0:13:45.120 --> 0:13:47.640
<v Speaker 1>and you're just trying to figure it out. So and

0:13:47.679 --> 0:13:49.400
<v Speaker 1>by the way, I mean pie is in p I

0:13:49.480 --> 0:13:53.840
<v Speaker 1>not as in the delicious pie dessert treat. So here's

0:13:53.880 --> 0:13:56.720
<v Speaker 1>the scenario. Imagine that you've got a table and the

0:13:56.760 --> 0:13:59.520
<v Speaker 1>tables like I don't know, three ft to a side,

0:14:00.040 --> 0:14:03.920
<v Speaker 1>and positioned over this table is a robotic arm, and

0:14:04.000 --> 0:14:07.720
<v Speaker 1>this robotic arm can pick up and drop large ball

0:14:07.800 --> 0:14:11.760
<v Speaker 1>bearings onto the table, and the arm can just move

0:14:11.880 --> 0:14:13.920
<v Speaker 1>over the entire region of the table, so it's got

0:14:13.920 --> 0:14:17.360
<v Speaker 1>a three ft by three ft range of motion. And

0:14:17.640 --> 0:14:21.880
<v Speaker 1>in on this table you set down two containers. You've

0:14:21.920 --> 0:14:26.360
<v Speaker 1>got one that's that's a circular container, and one that's square.

0:14:26.960 --> 0:14:31.160
<v Speaker 1>And the square container measures six inches to a side. Uh,

0:14:31.280 --> 0:14:35.440
<v Speaker 1>the radius of the circular circular container is also six inches,

0:14:35.480 --> 0:14:37.800
<v Speaker 1>so that means it's got a twelve inch diameter. Right.

0:14:38.080 --> 0:14:42.160
<v Speaker 1>So those are your containers, and you've got your situation

0:14:42.200 --> 0:14:45.680
<v Speaker 1>with your your robot arm above this three ft square table.

0:14:46.440 --> 0:14:48.840
<v Speaker 1>So the robotic arms job is to pick up ball

0:14:48.880 --> 0:14:54.320
<v Speaker 1>bearings and then from a random que will drop that

0:14:54.360 --> 0:14:58.120
<v Speaker 1>ball bearing somewhere above the table. So some of those

0:14:58.160 --> 0:15:00.920
<v Speaker 1>balls are going to fall into the square container, some

0:15:01.040 --> 0:15:03.720
<v Speaker 1>of them are going to fall into the round container.

0:15:03.800 --> 0:15:05.440
<v Speaker 1>Some of them are not going to fall in either.

0:15:06.200 --> 0:15:09.720
<v Speaker 1>And if the process is truly random, meaning there's an

0:15:09.800 --> 0:15:12.600
<v Speaker 1>equal chance that it will drop a ball bearing over

0:15:12.680 --> 0:15:16.800
<v Speaker 1>any given point of that table, over time, we would

0:15:16.800 --> 0:15:19.600
<v Speaker 1>expect to see more ball bearings fall into the round

0:15:19.680 --> 0:15:24.040
<v Speaker 1>container because it has a greater area and there's more

0:15:24.080 --> 0:15:27.360
<v Speaker 1>space for a ball bearing to fall into one of these.

0:15:27.920 --> 0:15:31.680
<v Speaker 1>At the end of repeating this process many many times,

0:15:32.000 --> 0:15:35.080
<v Speaker 1>we should be able to take these two containers and

0:15:35.120 --> 0:15:38.360
<v Speaker 1>then count the number of ball bearings in each of them.

0:15:38.440 --> 0:15:41.360
<v Speaker 1>And if we divide the number of ball bearings in

0:15:41.400 --> 0:15:44.680
<v Speaker 1>the circular container by the number of ball bearings that

0:15:44.720 --> 0:15:48.200
<v Speaker 1>fell into the square container, we're gonna get results that

0:15:48.240 --> 0:15:52.960
<v Speaker 1>should be really close to pie. And you might think, wait,

0:15:54.480 --> 0:15:57.960
<v Speaker 1>why why would the number of ball bearings in one

0:15:58.000 --> 0:16:01.680
<v Speaker 1>container versus another, and then divide fighting those why would

0:16:01.720 --> 0:16:04.160
<v Speaker 1>you get pie? Well, if you have a process that

0:16:04.400 --> 0:16:08.440
<v Speaker 1>is uniformly random across an area, like our hypothetical three

0:16:08.440 --> 0:16:12.520
<v Speaker 1>ft square table, the probability that a dropped ball bearing

0:16:12.520 --> 0:16:16.240
<v Speaker 1>will land in one of those two specific containers is

0:16:16.240 --> 0:16:21.120
<v Speaker 1>proportional to that specific containers area or cross section. So

0:16:21.520 --> 0:16:23.080
<v Speaker 1>then we just ask, all, right, well, how do we

0:16:23.160 --> 0:16:25.960
<v Speaker 1>define area? Well, with the square, it's really simple, right.

0:16:26.040 --> 0:16:28.800
<v Speaker 1>We take one side of a square in this case,

0:16:28.800 --> 0:16:32.080
<v Speaker 1>it's six inches, and we multiply it by itself six

0:16:32.120 --> 0:16:34.960
<v Speaker 1>times six. Because all sides of a square are equal,

0:16:35.040 --> 0:16:36.960
<v Speaker 1>we know that the length and the width are each

0:16:37.000 --> 0:16:39.760
<v Speaker 1>going to be six inches. We multiply those together. We

0:16:39.800 --> 0:16:42.840
<v Speaker 1>get thirty six square inches. That is the area or

0:16:42.960 --> 0:16:47.360
<v Speaker 1>cross section of our square container. But for our circular container,

0:16:48.000 --> 0:16:50.760
<v Speaker 1>we take the radius, which again in this case the

0:16:50.840 --> 0:16:53.960
<v Speaker 1>radius is six inches, and we square it and then

0:16:54.040 --> 0:16:59.000
<v Speaker 1>we multiply that number by pie. So area for the

0:16:59.120 --> 0:17:03.720
<v Speaker 1>circular contain or is six times six squared times pie.

0:17:03.840 --> 0:17:06.640
<v Speaker 1>And if we divide the cross section of the circular

0:17:06.680 --> 0:17:10.679
<v Speaker 1>container by the cross section of the square container, the

0:17:10.800 --> 0:17:15.600
<v Speaker 1>two six squared, you know, the two elements the squared

0:17:15.600 --> 0:17:18.400
<v Speaker 1>elements cancel each other out, and so all we're left

0:17:18.400 --> 0:17:22.120
<v Speaker 1>with is pie. So the end result is that when

0:17:22.160 --> 0:17:25.520
<v Speaker 1>we count up these ball bearings that have landed randomly

0:17:25.560 --> 0:17:29.399
<v Speaker 1>in these containers, that that difference, the division that we

0:17:29.520 --> 0:17:33.480
<v Speaker 1>get that should be a close approximation of pie. Now

0:17:33.520 --> 0:17:36.160
<v Speaker 1>it's not going to be precise. Chances are the number

0:17:36.160 --> 0:17:38.680
<v Speaker 1>of ball bearings in the two containers will just get

0:17:38.720 --> 0:17:42.560
<v Speaker 1>you close to pie. But it illustrates how a randomized

0:17:42.600 --> 0:17:46.480
<v Speaker 1>process can help you get to a particular solution that

0:17:46.600 --> 0:17:50.479
<v Speaker 1>might otherwise be difficult to ascertain. There are videos on

0:17:50.480 --> 0:17:53.359
<v Speaker 1>YouTube that show this particular simulation. It's kind of a

0:17:53.400 --> 0:17:56.400
<v Speaker 1>famous one, so you can actually watch and get kind

0:17:56.400 --> 0:17:58.520
<v Speaker 1>of an understanding of what I said to you makes

0:17:58.600 --> 0:18:02.159
<v Speaker 1>no sense whatsoever. There are other options for you to

0:18:02.240 --> 0:18:06.040
<v Speaker 1>look into that might help, and that is a great example.

0:18:06.600 --> 0:18:09.479
<v Speaker 1>But what are the actual algorithms that fall into the

0:18:09.560 --> 0:18:13.720
<v Speaker 1>Monte Carlo methods spectrum? What are they used to do well?

0:18:13.800 --> 0:18:17.119
<v Speaker 1>They can be used to simulate things like fluid dynamics

0:18:17.280 --> 0:18:21.919
<v Speaker 1>or cellular structures or the interaction of disordered materials. So

0:18:21.960 --> 0:18:25.159
<v Speaker 1>in other words, these are all processes. They have a

0:18:25.240 --> 0:18:28.600
<v Speaker 1>lot of potential variables at play, and you can think

0:18:28.640 --> 0:18:33.200
<v Speaker 1>of variables as representing uncertainty, something that computers typically don't

0:18:33.359 --> 0:18:37.679
<v Speaker 1>do well with. You know, from a general stance, computers

0:18:37.760 --> 0:18:43.640
<v Speaker 1>excel at specific instances rather than potential instances. So algorithms

0:18:43.680 --> 0:18:48.400
<v Speaker 1>like the Metropolis algorithm would lead computer scientists to develop

0:18:48.560 --> 0:18:52.719
<v Speaker 1>methodologies to kind of work around the limitations of computers

0:18:52.720 --> 0:18:58.359
<v Speaker 1>and leverage computational power and tackling very difficult problems in

0:18:58.400 --> 0:19:02.199
<v Speaker 1>that way. In the Monte Carlo family of algorithms, we

0:19:02.280 --> 0:19:05.600
<v Speaker 1>typically assume that the results we get are going to

0:19:06.560 --> 0:19:09.119
<v Speaker 1>have a potential for being wrong, like there'll be a

0:19:09.160 --> 0:19:12.080
<v Speaker 1>small percentage of error that we have to take into account,

0:19:12.640 --> 0:19:14.600
<v Speaker 1>and so keeping that in mind, we need to frame

0:19:14.640 --> 0:19:18.480
<v Speaker 1>results as being again approximations of an answer rather than

0:19:18.560 --> 0:19:21.800
<v Speaker 1>the definitive answer to whatever problem it is we're trying

0:19:21.840 --> 0:19:24.120
<v Speaker 1>to solve. For me, this was one of those things

0:19:24.119 --> 0:19:26.919
<v Speaker 1>that was very difficult to grasp for a long time

0:19:27.080 --> 0:19:30.480
<v Speaker 1>because I was equating it to math class, where you're

0:19:30.480 --> 0:19:33.359
<v Speaker 1>supposed to get the answer. Now, when we come back,

0:19:33.560 --> 0:19:36.360
<v Speaker 1>we'll talk about a few more famous algorithms and what

0:19:36.400 --> 0:19:46.720
<v Speaker 1>they do. But first let's take a quick break. Now.

0:19:46.760 --> 0:19:49.080
<v Speaker 1>In our previous section, I talked about a family of

0:19:49.119 --> 0:19:52.840
<v Speaker 1>algorithms that trace their history back to nineteen and so

0:19:52.960 --> 0:19:55.200
<v Speaker 1>does the next one I want to talk about, which

0:19:55.240 --> 0:19:59.879
<v Speaker 1>was created by George Dantzig who worked for the Rand Corporation,

0:20:00.040 --> 0:20:03.520
<v Speaker 1>and Danzig created a process that would lead to what

0:20:03.560 --> 0:20:08.160
<v Speaker 1>we call linear programming. So at its most basic level,

0:20:08.400 --> 0:20:12.919
<v Speaker 1>linear programming is about taking some function and maximizing or

0:20:13.040 --> 0:20:17.119
<v Speaker 1>minimizing that function with regard to various constraints. But that

0:20:17.200 --> 0:20:19.800
<v Speaker 1>is super vague, right, I mean, it's not terribly helpful.

0:20:20.080 --> 0:20:22.520
<v Speaker 1>It feels like I'm talking in a circle. But this

0:20:22.600 --> 0:20:26.320
<v Speaker 1>is one that's really important for say, business developers. So

0:20:26.400 --> 0:20:29.600
<v Speaker 1>let's talk about a slightly more specific use case. Let's

0:20:29.600 --> 0:20:32.680
<v Speaker 1>say that you are launching a business and you're trying

0:20:32.720 --> 0:20:35.800
<v Speaker 1>to make some you know, big decisions as you're going

0:20:35.840 --> 0:20:38.840
<v Speaker 1>to do this, and you're going to manufacture and sell

0:20:39.040 --> 0:20:42.439
<v Speaker 1>a product of some sort, some physical thing. Now, your

0:20:42.480 --> 0:20:45.800
<v Speaker 1>whole goal as a business is to make money from

0:20:46.000 --> 0:20:48.359
<v Speaker 1>the work you do, and to do that, you need

0:20:48.400 --> 0:20:50.720
<v Speaker 1>to figure out what your costs are going to be

0:20:51.359 --> 0:20:55.400
<v Speaker 1>and how you cannot just offset these costs but make

0:20:55.520 --> 0:20:59.440
<v Speaker 1>enough money to actually profit from it, so cover all

0:20:59.480 --> 0:21:03.360
<v Speaker 1>your costs plus some extra. So in this case, what

0:21:03.400 --> 0:21:05.560
<v Speaker 1>you're trying to do is figuring out how you can

0:21:05.600 --> 0:21:11.720
<v Speaker 1>minimize costs and maximize profits. Right. The constraints come into

0:21:11.720 --> 0:21:15.080
<v Speaker 1>play as you start to look at specifics, like maybe

0:21:15.119 --> 0:21:18.200
<v Speaker 1>you're gonna partner with a fabrication company, and maybe you've

0:21:18.200 --> 0:21:20.679
<v Speaker 1>actually got a few choices. You've got different companies that

0:21:20.720 --> 0:21:23.679
<v Speaker 1>you could go with. Well, these choices could represent constraints

0:21:23.680 --> 0:21:27.480
<v Speaker 1>in your approach. Perhaps one is more expensive than the others,

0:21:27.480 --> 0:21:31.200
<v Speaker 1>but it can produce a greater volume of product, so

0:21:31.440 --> 0:21:34.119
<v Speaker 1>you'd be able to get more product out to market

0:21:34.280 --> 0:21:38.480
<v Speaker 1>in less time. Or maybe you've got one that's more expensive,

0:21:38.600 --> 0:21:42.800
<v Speaker 1>but it's also less likely to have fabrication errors, and

0:21:43.080 --> 0:21:46.680
<v Speaker 1>errors can be both costly and time consuming to address,

0:21:46.720 --> 0:21:50.280
<v Speaker 1>So you have to quantify all these variables and use

0:21:50.359 --> 0:21:54.040
<v Speaker 1>them as constraints to start figuring out your men maxing approach.

0:21:54.119 --> 0:21:58.400
<v Speaker 1>Here line, your programming simply looks for the optimum value

0:21:58.560 --> 0:22:01.920
<v Speaker 1>of a linear expression, and depending on the problem you're

0:22:01.960 --> 0:22:06.280
<v Speaker 1>trying to solve, like maximizing profit versus minimizing costs, you're

0:22:06.280 --> 0:22:09.800
<v Speaker 1>either looking for the highest value being optimum or the

0:22:09.800 --> 0:22:12.639
<v Speaker 1>lowest value being optimum. Like with costs, you want that

0:22:12.680 --> 0:22:14.840
<v Speaker 1>to be the lowest, and you have to look at

0:22:14.880 --> 0:22:19.119
<v Speaker 1>what constraints are at play with any given expression. So

0:22:19.200 --> 0:22:23.359
<v Speaker 1>Danzig's approach to linear programming, called the simplex method, was

0:22:23.440 --> 0:22:27.639
<v Speaker 1>efficient and elegant and far more simplified than other methodologies

0:22:27.680 --> 0:22:31.000
<v Speaker 1>attempting to kind of do the same thing around that time.

0:22:31.080 --> 0:22:34.359
<v Speaker 1>But it also had some limitations, and that's because the

0:22:34.400 --> 0:22:38.040
<v Speaker 1>real world isn't as simple as math tends to be.

0:22:38.359 --> 0:22:42.520
<v Speaker 1>Like math tends to be pretty, you know, firm in

0:22:42.560 --> 0:22:44.320
<v Speaker 1>the grand scheme of things, in the world is a

0:22:44.320 --> 0:22:48.280
<v Speaker 1>little more wibbly wobbly. So a linear programming solution only

0:22:48.280 --> 0:22:52.600
<v Speaker 1>works if the various relationships between the different elements like

0:22:52.680 --> 0:22:55.520
<v Speaker 1>the requirements and the restrictions and the constraints that you've

0:22:55.560 --> 0:22:57.760
<v Speaker 1>set up with this problem. It only works if all

0:22:57.800 --> 0:23:01.040
<v Speaker 1>of those relationships are linear or other words, for a

0:23:01.040 --> 0:23:04.840
<v Speaker 1>given change in one variable, we see a given change

0:23:04.960 --> 0:23:08.800
<v Speaker 1>in other variables, and that is super vague. So we're

0:23:08.800 --> 0:23:11.400
<v Speaker 1>going to talk about two variables. Will reduce it down

0:23:11.400 --> 0:23:14.840
<v Speaker 1>to that. So we'll use the classic X and Y

0:23:14.920 --> 0:23:17.720
<v Speaker 1>as our variables. Those can stand in for all sorts

0:23:17.720 --> 0:23:21.520
<v Speaker 1>of different values. And let's say that we see there's

0:23:21.520 --> 0:23:24.520
<v Speaker 1>a relationship between X and Y, and that if the

0:23:24.600 --> 0:23:29.600
<v Speaker 1>value of X changes from one to two, we then

0:23:29.640 --> 0:23:34.040
<v Speaker 1>see that the value of hy goes from three to nine. Well,

0:23:34.040 --> 0:23:36.359
<v Speaker 1>that doesn't tell us anything on its own, right. We

0:23:36.440 --> 0:23:39.320
<v Speaker 1>just know that if x is one, y is three.

0:23:39.400 --> 0:23:42.360
<v Speaker 1>If x is two, y is nine. If we then

0:23:42.400 --> 0:23:46.879
<v Speaker 1>see that if x is three, then why is fifteen?

0:23:47.400 --> 0:23:52.200
<v Speaker 1>And when x is four, why is twenty one? We

0:23:52.359 --> 0:23:55.600
<v Speaker 1>start to see a linear relationship because each time x

0:23:55.640 --> 0:23:59.679
<v Speaker 1>increases by one, Y increases by six, the rate of

0:23:59.720 --> 0:24:05.080
<v Speaker 1>increase for each variable is linear. It's it's not like

0:24:05.119 --> 0:24:08.000
<v Speaker 1>the rate of increase doesn't change. So we've got this

0:24:08.119 --> 0:24:14.040
<v Speaker 1>linear relationship here. We can contrast this with exponential relationships,

0:24:14.080 --> 0:24:17.879
<v Speaker 1>in which we see not a constant increase but a

0:24:17.960 --> 0:24:22.359
<v Speaker 1>constant ratio in successive terms in one variable when you

0:24:22.480 --> 0:24:25.439
<v Speaker 1>change another. So in this case, let's say that we

0:24:25.520 --> 0:24:28.680
<v Speaker 1>find out then when X is one, why is three?

0:24:29.320 --> 0:24:33.160
<v Speaker 1>When X is two, why is nine? When X is three,

0:24:33.720 --> 0:24:37.000
<v Speaker 1>why is twenties seven? Now we see that why is

0:24:37.000 --> 0:24:42.000
<v Speaker 1>not increasing by six each time. We're seeing that the

0:24:42.080 --> 0:24:46.000
<v Speaker 1>value of why is multiplied by three each time X

0:24:46.000 --> 0:24:48.760
<v Speaker 1>goes up one. So we're seeing there's a constant ratio

0:24:49.000 --> 0:24:52.760
<v Speaker 1>of change with why with regard to X. This gets

0:24:52.840 --> 0:24:56.959
<v Speaker 1>into an exponential relationship. So when someone describes something as

0:24:57.000 --> 0:25:02.439
<v Speaker 1>having exponential growth, what this is supposed to mean is

0:25:02.480 --> 0:25:06.439
<v Speaker 1>that you should see a rate of growth that is

0:25:06.520 --> 0:25:11.159
<v Speaker 1>increasing by some exponent per given unit of time. So

0:25:11.200 --> 0:25:14.320
<v Speaker 1>it's not just that the thing is growing. In fact,

0:25:14.320 --> 0:25:17.520
<v Speaker 1>it's not even that the thing is growing quickly. It's

0:25:17.600 --> 0:25:21.160
<v Speaker 1>that the thing is growing faster as time goes on,

0:25:21.320 --> 0:25:25.400
<v Speaker 1>so that you would say today it's growing, you know, say,

0:25:25.400 --> 0:25:28.000
<v Speaker 1>twice as fast as it was growing yesterday, and tomorrow

0:25:28.040 --> 0:25:31.240
<v Speaker 1>it will grow twice as fast as it was growing today.

0:25:31.400 --> 0:25:34.199
<v Speaker 1>And a lot of people use this phrase incorrectly. We

0:25:34.280 --> 0:25:39.200
<v Speaker 1>often really just mean yo, that thing is growing wicked fast,

0:25:39.880 --> 0:25:42.960
<v Speaker 1>But we don't necessarily mean yo, that thing is growing

0:25:43.000 --> 0:25:45.399
<v Speaker 1>wicked fast, and the rate of growth increases by a

0:25:45.440 --> 0:25:51.160
<v Speaker 1>constant amount over time, so you know, it's it's an

0:25:51.160 --> 0:25:54.560
<v Speaker 1>important distinction to make. Anyway, that was a bit of

0:25:54.600 --> 0:25:57.560
<v Speaker 1>a tangent to say that linear programming works if the

0:25:57.680 --> 0:26:01.520
<v Speaker 1>relationships between all the variables is in fact linear. But

0:26:01.800 --> 0:26:05.760
<v Speaker 1>if if it's not, if the relationship says exponential or

0:26:05.840 --> 0:26:10.800
<v Speaker 1>logarithmic or anything like that, linear programming doesn't apply. And

0:26:11.119 --> 0:26:14.480
<v Speaker 1>the real world is pretty darn complicated. So linear programming

0:26:14.480 --> 0:26:17.560
<v Speaker 1>relies on sort of kind of dumbing down what's really

0:26:17.560 --> 0:26:20.119
<v Speaker 1>going on in the real world. Two. Again, more of

0:26:20.160 --> 0:26:23.400
<v Speaker 1>an approximation, and the solution that you arrive at might

0:26:23.440 --> 0:26:26.760
<v Speaker 1>not be the ideal solution, but it might be good enough,

0:26:26.840 --> 0:26:29.800
<v Speaker 1>depending upon what it is you're trying to do. Another

0:26:29.840 --> 0:26:33.160
<v Speaker 1>limitation of linear programming is that as you add more

0:26:33.240 --> 0:26:37.119
<v Speaker 1>variables to a problem. This is specific to the simplex method.

0:26:37.160 --> 0:26:40.840
<v Speaker 1>As you add more variables, well, it grows more difficult

0:26:40.880 --> 0:26:44.879
<v Speaker 1>to lay out in a linear fashion. You're you're adding

0:26:44.920 --> 0:26:51.560
<v Speaker 1>more uncertainty, and the methodology has trouble dealing with additional uncertainty.

0:26:51.600 --> 0:26:56.000
<v Speaker 1>Perhaps ironically, the complexity of the linear function would grow

0:26:56.280 --> 0:27:00.680
<v Speaker 1>exponentially as more variables joined a problem, so the process

0:27:01.080 --> 0:27:05.240
<v Speaker 1>would be unsuitable for certain subsets of computational problems, because

0:27:05.280 --> 0:27:07.560
<v Speaker 1>they just would get so complex that even the most

0:27:07.560 --> 0:27:10.960
<v Speaker 1>advanced computers in the world wouldn't be able to handle them.

0:27:11.040 --> 0:27:15.520
<v Speaker 1>Later on, other mathematicians would propose algorithms that could compensate

0:27:15.640 --> 0:27:19.920
<v Speaker 1>for this particular limitation of the simplex method. For example,

0:27:20.000 --> 0:27:23.760
<v Speaker 1>there are polynomial time algorithms, but we're gonna leave that

0:27:23.800 --> 0:27:26.840
<v Speaker 1>for the time being, because ain't no way I'm going

0:27:26.880 --> 0:27:30.800
<v Speaker 1>to get that right anyway. I wanted to talk about

0:27:30.880 --> 0:27:34.359
<v Speaker 1>those two algorithms, in particular, the metropolis algorithm and the

0:27:34.400 --> 0:27:38.240
<v Speaker 1>simplex method, because they are the foundation for a lot

0:27:38.320 --> 0:27:41.160
<v Speaker 1>of work that's been done in computer science. But let's

0:27:41.200 --> 0:27:45.239
<v Speaker 1>get some really basic ideas in with the next one.

0:27:45.359 --> 0:27:50.000
<v Speaker 1>Let's talk about sorting. Sorting is all about arranging a

0:27:50.119 --> 0:27:54.400
<v Speaker 1>list of things in order with regard to some specific

0:27:54.640 --> 0:27:59.120
<v Speaker 1>feature of those things. That seems pretty basic, right, I Mean,

0:27:59.880 --> 0:28:01.920
<v Speaker 1>there's a real world example that I think most of

0:28:02.000 --> 0:28:04.360
<v Speaker 1>us have had in the past, which is that let's

0:28:04.400 --> 0:28:07.560
<v Speaker 1>say you're looking at an online store and you're searching

0:28:07.600 --> 0:28:12.240
<v Speaker 1>for a specific product or specific type of product. Let's

0:28:12.240 --> 0:28:15.600
<v Speaker 1>say it's a blender. Because I had to do this recently, right,

0:28:16.119 --> 0:28:18.840
<v Speaker 1>So you go to some online store and you're searching

0:28:18.840 --> 0:28:21.840
<v Speaker 1>for blenders and you get results, Well, you might actually

0:28:21.840 --> 0:28:24.320
<v Speaker 1>want to sort those results by a specific way. Maybe

0:28:24.320 --> 0:28:26.080
<v Speaker 1>you want to sort it by price, and you want

0:28:26.080 --> 0:28:28.719
<v Speaker 1>to go low too high because you have a specific budget,

0:28:28.760 --> 0:28:31.080
<v Speaker 1>so you just want to look at, you know, blenders

0:28:31.080 --> 0:28:34.720
<v Speaker 1>that are an x price or less. Maybe you want

0:28:34.720 --> 0:28:37.320
<v Speaker 1>to sort it by high price too low because maybe

0:28:37.320 --> 0:28:39.600
<v Speaker 1>you're a fat cat tycoon type and you're just thinking,

0:28:39.640 --> 0:28:42.800
<v Speaker 1>I want whatever is the most expensive. Or maybe you

0:28:42.840 --> 0:28:45.880
<v Speaker 1>want to sort the results by customer review because we

0:28:45.960 --> 0:28:49.560
<v Speaker 1>know price and quality don't always go hand in hand.

0:28:50.240 --> 0:28:52.480
<v Speaker 1>Maybe you just want to look at all the blenders

0:28:52.480 --> 0:28:54.600
<v Speaker 1>in alphabetical order, or maybe you want to look at

0:28:54.640 --> 0:28:58.520
<v Speaker 1>them in a reverse alphabetical order. You do you. Sorting

0:28:58.680 --> 0:29:02.040
<v Speaker 1>is one of those most base sick functions and heavily

0:29:02.120 --> 0:29:06.240
<v Speaker 1>studied concepts within computer science, so much so that a

0:29:06.320 --> 0:29:12.560
<v Speaker 1>lot of programming language libraries have sorting functions built into them.

0:29:12.680 --> 0:29:15.360
<v Speaker 1>But it's still one of those things that people look

0:29:15.360 --> 0:29:18.560
<v Speaker 1>at to see if there are better ways to sort

0:29:19.080 --> 0:29:22.960
<v Speaker 1>various types of data, particularly as you get into a

0:29:23.080 --> 0:29:28.200
<v Speaker 1>larger number of of sortable features um and it becomes

0:29:28.200 --> 0:29:32.000
<v Speaker 1>really important. So let's take Google's search algorithm for example.

0:29:32.840 --> 0:29:35.720
<v Speaker 1>Now that name suggests that the algorithm we're talking about

0:29:35.760 --> 0:29:38.680
<v Speaker 1>is related to the process of searching the web for

0:29:38.760 --> 0:29:41.760
<v Speaker 1>pages that relate to a given search query, and in fact,

0:29:41.760 --> 0:29:45.160
<v Speaker 1>Google does have a search algorithm that does this, But

0:29:45.440 --> 0:29:47.360
<v Speaker 1>most of the time I hear people talking about the

0:29:47.400 --> 0:29:52.200
<v Speaker 1>search algorithm, they actually mean that the algorithm that Google

0:29:52.280 --> 0:29:56.640
<v Speaker 1>relies upon to determine what the order of search results

0:29:56.680 --> 0:29:59.240
<v Speaker 1>are going to be that a person sees when they

0:29:59.280 --> 0:30:02.240
<v Speaker 1>search for, you know, whatever it might be. This is

0:30:02.240 --> 0:30:06.680
<v Speaker 1>critically important because multiple studies have shown that most people

0:30:06.880 --> 0:30:10.080
<v Speaker 1>never bother to go beyond the first page of search results,

0:30:10.600 --> 0:30:13.360
<v Speaker 1>which means that Google really needs to do its best

0:30:13.520 --> 0:30:17.080
<v Speaker 1>to make sure that the most relevant results to any

0:30:17.240 --> 0:30:21.520
<v Speaker 1>given search query show up toward the top of this list,

0:30:21.600 --> 0:30:25.000
<v Speaker 1>because most people are never going to bother going any

0:30:25.040 --> 0:30:27.959
<v Speaker 1>further than that. And if those people decide that Google

0:30:28.000 --> 0:30:31.800
<v Speaker 1>search results just aren't any good, they could conceivably use

0:30:31.880 --> 0:30:34.840
<v Speaker 1>some other search engine, and let me tell you, Google

0:30:35.040 --> 0:30:39.800
<v Speaker 1>hates that idea. So Google's goal is to present to

0:30:39.960 --> 0:30:43.520
<v Speaker 1>users search results that are most likely going to meet

0:30:43.680 --> 0:30:47.520
<v Speaker 1>whatever their needs are based on their search criteria and

0:30:47.600 --> 0:30:51.320
<v Speaker 1>way back in the day, Google relied pretty much solely

0:30:51.440 --> 0:30:55.520
<v Speaker 1>on an algorithm called page rank uh, and from what

0:30:55.560 --> 0:30:58.720
<v Speaker 1>I understand, Google still relies on page rank, but also

0:30:58.800 --> 0:31:03.560
<v Speaker 1>makes use of several other algorithms to augment page drink.

0:31:04.200 --> 0:31:07.520
<v Speaker 1>But the page drink algorithm would take a ton of

0:31:07.560 --> 0:31:12.440
<v Speaker 1>stuff into account in the process of determining where within

0:31:12.480 --> 0:31:16.000
<v Speaker 1>a list of search results any given example should appear.

0:31:16.640 --> 0:31:21.480
<v Speaker 1>So let's say that I'm searching for blenders on Google

0:31:22.080 --> 0:31:26.840
<v Speaker 1>for some reason, and the search algorithm has gone out

0:31:26.920 --> 0:31:30.440
<v Speaker 1>and indexed a ton of web pages that deal with blenders.

0:31:31.040 --> 0:31:34.760
<v Speaker 1>Let's say that one of those results is in a

0:31:34.840 --> 0:31:38.520
<v Speaker 1>blog post that isn't that old, it's fairly recent but

0:31:38.800 --> 0:31:43.080
<v Speaker 1>from a mostly unknown source, and very few other documents

0:31:43.080 --> 0:31:47.960
<v Speaker 1>are linking into this blog. Well, chances are that search

0:31:47.960 --> 0:31:52.240
<v Speaker 1>result would appear really far down on the list, probably

0:31:52.680 --> 0:31:56.320
<v Speaker 1>pages and pages and pages down on the results. But

0:31:56.360 --> 0:31:59.080
<v Speaker 1>then let's say that there's another web page that belongs

0:31:59.120 --> 0:32:02.680
<v Speaker 1>to an estab abolished entity, one that has a good reputation,

0:32:02.800 --> 0:32:05.080
<v Speaker 1>it's been around for a while, and there are a

0:32:05.080 --> 0:32:10.280
<v Speaker 1>ton of other pages that link to this particular website. Well,

0:32:10.320 --> 0:32:13.760
<v Speaker 1>that one would probably rank fairly high on the list.

0:32:14.760 --> 0:32:19.000
<v Speaker 1>So The page rank algorithm essentially assigns a score to

0:32:19.120 --> 0:32:22.440
<v Speaker 1>each search result, and the value of that score depends

0:32:22.480 --> 0:32:25.200
<v Speaker 1>upon lots of stuff I mentioned, as well as tons

0:32:25.240 --> 0:32:28.520
<v Speaker 1>of other variables, and these variables can either boost a

0:32:28.560 --> 0:32:31.920
<v Speaker 1>score higher or it can knock some points off. And

0:32:31.960 --> 0:32:35.040
<v Speaker 1>then page rank would take all these different search results

0:32:35.080 --> 0:32:41.600
<v Speaker 1>and order them based upon those scores. Essentially really oversimplifying here,

0:32:42.040 --> 0:32:44.880
<v Speaker 1>but the idea was that the more reliable and therefore

0:32:45.040 --> 0:32:48.960
<v Speaker 1>relevant results would likely be the ones that were the

0:32:49.000 --> 0:32:52.520
<v Speaker 1>most popular. So all those links that aimed at a

0:32:52.560 --> 0:32:55.800
<v Speaker 1>page would count for a lot. If you happen to

0:32:55.880 --> 0:33:00.200
<v Speaker 1>run the definitive page on Blenders and everyone was linking you,

0:33:00.200 --> 0:33:05.760
<v Speaker 1>you that would boost your page links score significantly. Now, clearly,

0:33:06.200 --> 0:33:10.400
<v Speaker 1>just because something is popular doesn't necessarily mean it's the

0:33:10.480 --> 0:33:16.560
<v Speaker 1>most relevant or valuable thing, but it's generally more true

0:33:16.600 --> 0:33:20.239
<v Speaker 1>than it isn't true. It might not always be the

0:33:20.280 --> 0:33:24.720
<v Speaker 1>absolute best result, but it might be reliably relevant, and

0:33:24.800 --> 0:33:28.600
<v Speaker 1>that was what was important to Google and to Google's users. Again,

0:33:28.880 --> 0:33:32.160
<v Speaker 1>it just needs to be good enough. So the page

0:33:32.240 --> 0:33:35.960
<v Speaker 1>rank algorithm was using a pretty complex sorting method to

0:33:36.000 --> 0:33:39.680
<v Speaker 1>determine which results should be the most visible. You can

0:33:39.840 --> 0:33:43.600
<v Speaker 1>of course page through search results. You don't have to

0:33:43.640 --> 0:33:47.520
<v Speaker 1>go with whichever ones are on page one. And in theory,

0:33:48.080 --> 0:33:52.280
<v Speaker 1>if you keep on scrolling through, going to page after

0:33:52.320 --> 0:33:56.680
<v Speaker 1>page after page of search results, then over time you

0:33:56.720 --> 0:33:59.560
<v Speaker 1>should see that the results you're getting are not as

0:33:59.600 --> 0:34:02.600
<v Speaker 1>relevant it as those that appeared earlier on the list,

0:34:02.880 --> 0:34:06.720
<v Speaker 1>assuming everything is working properly. Again, this doesn't always happen,

0:34:07.240 --> 0:34:12.080
<v Speaker 1>but generally it's all it holds true. And yeah, I'm

0:34:12.200 --> 0:34:16.800
<v Speaker 1>drastically oversimplifying. You could teach an entire computer science course

0:34:17.080 --> 0:34:20.879
<v Speaker 1>on the page rink algorithm and how it works. We're

0:34:20.920 --> 0:34:22.799
<v Speaker 1>not going to do that. I would just get it

0:34:22.880 --> 0:34:26.640
<v Speaker 1>wrong anyway. Speaking of search, however, let's talk about a

0:34:26.760 --> 0:34:30.839
<v Speaker 1>much simpler form of search that's based on a basic algorithm,

0:34:30.840 --> 0:34:34.840
<v Speaker 1>and this is called binary search. This is a process

0:34:34.880 --> 0:34:37.200
<v Speaker 1>that's meant to decrease the amount of time it takes

0:34:37.239 --> 0:34:42.280
<v Speaker 1>to search for a specific value within a sordid array

0:34:42.520 --> 0:34:45.440
<v Speaker 1>of values. Alright, So let's say that you've got a

0:34:45.560 --> 0:34:51.880
<v Speaker 1>really big array or list of entries, right, and it's massive,

0:34:52.360 --> 0:34:56.480
<v Speaker 1>and you're searching for a specific target that has a

0:34:56.520 --> 0:35:02.439
<v Speaker 1>specific value associated with it. And computer could go through

0:35:02.480 --> 0:35:06.240
<v Speaker 1>this list item by item, comparing it with your target

0:35:06.560 --> 0:35:08.960
<v Speaker 1>right and look to see if there's a match. If

0:35:08.960 --> 0:35:10.560
<v Speaker 1>there's not a match, you can go to the next

0:35:10.560 --> 0:35:13.480
<v Speaker 1>item on the list and do that. But if you're

0:35:13.480 --> 0:35:16.720
<v Speaker 1>talking about a truly huge list, this could take ages

0:35:16.800 --> 0:35:19.080
<v Speaker 1>because if it happens to be at the bottom of

0:35:19.080 --> 0:35:20.640
<v Speaker 1>that list, you have to wait for the computer to

0:35:20.680 --> 0:35:24.520
<v Speaker 1>go through every single other entry before it gets there.

0:35:25.040 --> 0:35:30.799
<v Speaker 1>So a binary search cuts this short. It takes a

0:35:30.960 --> 0:35:34.080
<v Speaker 1>value that's in the middle of the array, so like

0:35:34.200 --> 0:35:38.400
<v Speaker 1>halfway down the list. Essentially, it just pulls that value

0:35:38.719 --> 0:35:41.040
<v Speaker 1>and it compares it against your target, the thing that

0:35:41.120 --> 0:35:44.640
<v Speaker 1>you're searching for. And if the array is a hundred

0:35:44.680 --> 0:35:47.880
<v Speaker 1>thousand entries long, it's essentially looking at entry number fifty

0:35:48.000 --> 0:35:51.920
<v Speaker 1>thousand and one. It compares this to your search. And

0:35:52.000 --> 0:35:55.440
<v Speaker 1>let's say the value target of your of your search

0:35:55.520 --> 0:36:00.280
<v Speaker 1>query is lower than the entry that appeared at fifty

0:36:00.320 --> 0:36:04.160
<v Speaker 1>thousand and one. Well, now the binary search just tosses

0:36:04.360 --> 0:36:07.840
<v Speaker 1>everything that's fifty thousand and one or higher on the

0:36:07.920 --> 0:36:10.359
<v Speaker 1>list because the values are only going to go up

0:36:10.360 --> 0:36:13.160
<v Speaker 1>from there, so it can get rid of half the

0:36:13.239 --> 0:36:17.239
<v Speaker 1>list right there. You're left with fifty thousand items in

0:36:17.320 --> 0:36:21.879
<v Speaker 1>this array, and the algorithm repeats this process. It goes

0:36:21.960 --> 0:36:25.040
<v Speaker 1>for an entry smack deb in the middle of the array,

0:36:25.160 --> 0:36:28.319
<v Speaker 1>compares it to the target. If the target's value is

0:36:28.440 --> 0:36:34.719
<v Speaker 1>lower than the middle entry of this array, then you

0:36:35.120 --> 0:36:38.200
<v Speaker 1>you dump everything that's at a higher number than that

0:36:39.080 --> 0:36:41.960
<v Speaker 1>if it's lower or it's higher. Rather, if the target

0:36:42.040 --> 0:36:44.399
<v Speaker 1>value is higher than the middle entry, then you would

0:36:44.400 --> 0:36:46.759
<v Speaker 1>get rid of all the previous ones, like one through

0:36:46.800 --> 0:36:49.120
<v Speaker 1>twenty five thousand. For example, Let's say that you know

0:36:50.080 --> 0:36:53.080
<v Speaker 1>your your target value is higher than the middle entry

0:36:53.080 --> 0:36:56.480
<v Speaker 1>of twenty five and one. It's gonna dump everything from

0:36:56.480 --> 0:36:58.920
<v Speaker 1>one to twenty five thousand and start over again and

0:36:59.000 --> 0:37:02.040
<v Speaker 1>half it again again. I'm kind of oversimplifying here, but

0:37:02.080 --> 0:37:04.800
<v Speaker 1>the idea of binary search is that rather than go

0:37:04.880 --> 0:37:09.520
<v Speaker 1>through every single entry, it keeps cutting this array in half,

0:37:09.960 --> 0:37:13.319
<v Speaker 1>comparing it with the target, and doing it again, which

0:37:13.320 --> 0:37:16.440
<v Speaker 1>reduces the number of times it takes to find the

0:37:16.480 --> 0:37:19.960
<v Speaker 1>specific answer. UH. You might have thought of the like

0:37:20.000 --> 0:37:23.520
<v Speaker 1>the the experiment where you think about you're given two

0:37:23.560 --> 0:37:26.560
<v Speaker 1>pennies on day one, and the next day you're given

0:37:26.600 --> 0:37:29.960
<v Speaker 1>four pennies or cents if you prefer two cents. The

0:37:29.960 --> 0:37:31.640
<v Speaker 1>next day you get four cents, the next day you

0:37:31.680 --> 0:37:35.359
<v Speaker 1>get eight cents and it doubles, and pretty quickly you

0:37:35.440 --> 0:37:37.719
<v Speaker 1>see how that doubling can actually start to amount to

0:37:37.800 --> 0:37:40.480
<v Speaker 1>what we would consider, you know, like quote unquote real money,

0:37:40.800 --> 0:37:44.120
<v Speaker 1>the same sort of thing. By by having an array

0:37:44.239 --> 0:37:47.759
<v Speaker 1>over and over again, you very quickly whittle down the

0:37:47.760 --> 0:37:49.839
<v Speaker 1>stuff you have to go through and it speeds up

0:37:49.880 --> 0:37:52.680
<v Speaker 1>the process of searching for a specific value within a

0:37:52.840 --> 0:37:58.280
<v Speaker 1>huge UH data list. Binary search is just one form

0:37:58.320 --> 0:38:02.080
<v Speaker 1>of search for for various data constructs. There are lots

0:38:02.080 --> 0:38:06.240
<v Speaker 1>of others. For example, there's depth first search and breadth

0:38:06.440 --> 0:38:09.520
<v Speaker 1>first search. I won't get too deep into this but

0:38:09.960 --> 0:38:12.799
<v Speaker 1>because it gets really technical, but I can describe what's

0:38:12.920 --> 0:38:16.640
<v Speaker 1>what's happening here from a high level. So these search

0:38:16.680 --> 0:38:20.640
<v Speaker 1>functions are used for data structures that are that consists

0:38:20.680 --> 0:38:24.000
<v Speaker 1>of nodes. And this is easier to understand if we

0:38:24.160 --> 0:38:26.680
<v Speaker 1>use an analogy. And I want you to think of

0:38:26.719 --> 0:38:30.279
<v Speaker 1>a Choose your own Adventure book in case you're not

0:38:30.360 --> 0:38:33.600
<v Speaker 1>familiar with those. These are books where you would read

0:38:33.640 --> 0:38:35.360
<v Speaker 1>a page and at the end of the page you

0:38:35.400 --> 0:38:37.720
<v Speaker 1>would actually be given a choice, like you could choose

0:38:38.000 --> 0:38:41.600
<v Speaker 1>what the character you're reading about would do next, So

0:38:42.040 --> 0:38:44.320
<v Speaker 1>you might get to the end of the first page

0:38:44.320 --> 0:38:48.600
<v Speaker 1>of like a mystery book, and the instruction might say,

0:38:48.719 --> 0:38:51.479
<v Speaker 1>if you want your protagonists to go down the hall,

0:38:51.880 --> 0:38:54.600
<v Speaker 1>turn to page eight. If you want her to shut

0:38:54.600 --> 0:38:57.759
<v Speaker 1>a door and walk away, turn to page twenty three,

0:38:58.160 --> 0:38:59.959
<v Speaker 1>and you would make your choice, turn to that page

0:39:00.160 --> 0:39:03.040
<v Speaker 1>and continue the story that way. And so the story branches,

0:39:03.840 --> 0:39:07.520
<v Speaker 1>and you've got these branching pathways. Well. Depth first and

0:39:07.600 --> 0:39:12.800
<v Speaker 1>breadth first searches explore nodes in different ways. A depth

0:39:12.960 --> 0:39:17.719
<v Speaker 1>first search follows each branched path all the way down

0:39:17.760 --> 0:39:21.320
<v Speaker 1>from start to the end of that one branch, before

0:39:21.440 --> 0:39:24.759
<v Speaker 1>moving on to look at a different branch. So, in

0:39:24.800 --> 0:39:27.520
<v Speaker 1>our example, would the Choose your Own Adventure book, a

0:39:27.600 --> 0:39:31.080
<v Speaker 1>depth first search would go to page eight to follow

0:39:31.480 --> 0:39:36.040
<v Speaker 1>your protagonist down the hall. Then whatever the options were

0:39:36.080 --> 0:39:37.440
<v Speaker 1>at the end of that, it would go with the

0:39:37.480 --> 0:39:41.360
<v Speaker 1>first option, continue and doing this all the time until

0:39:41.400 --> 0:39:43.600
<v Speaker 1>you get to the end of that pathway. Then it

0:39:43.600 --> 0:39:46.320
<v Speaker 1>would come back up to the next most recent branch,

0:39:46.440 --> 0:39:48.200
<v Speaker 1>follow that all the way to the end, and so

0:39:48.280 --> 0:39:52.560
<v Speaker 1>on until it had searched through every possible pathway in

0:39:52.640 --> 0:39:56.040
<v Speaker 1>this this uh, this graph is what we would call

0:39:56.080 --> 0:40:03.080
<v Speaker 1>it breath search. Instead, progress is equally across all possible paths.

0:40:03.120 --> 0:40:06.440
<v Speaker 1>So breath search would mean that you would go to

0:40:06.560 --> 0:40:09.920
<v Speaker 1>page eight, and let's say at the end of page eight,

0:40:09.960 --> 0:40:12.440
<v Speaker 1>it says you can then turn to page seventeen or

0:40:12.520 --> 0:40:14.920
<v Speaker 1>page fifty two to make your next choice. But instead

0:40:14.920 --> 0:40:17.839
<v Speaker 1>of continuing down that pathway, you back up to your

0:40:17.840 --> 0:40:21.000
<v Speaker 1>starting position and then you go down to page twenty three.

0:40:21.040 --> 0:40:22.799
<v Speaker 1>You know, the other option where you would close the

0:40:22.800 --> 0:40:25.400
<v Speaker 1>door and walk away. You would read that maybe at

0:40:25.400 --> 0:40:27.680
<v Speaker 1>the end of that page it says you can choose

0:40:27.680 --> 0:40:30.880
<v Speaker 1>to either go to page three or to page forty six. Well,

0:40:31.080 --> 0:40:33.399
<v Speaker 1>then you would go back to your your first branch.

0:40:33.480 --> 0:40:37.920
<v Speaker 1>You would go down the list of pages seventeen and

0:40:38.000 --> 0:40:41.239
<v Speaker 1>fifty two and three and forty six, maybe those all

0:40:41.360 --> 0:40:44.319
<v Speaker 1>end in different choices. You would then do all of

0:40:44.360 --> 0:40:46.760
<v Speaker 1>those across the board next, so you're you're searching across

0:40:46.840 --> 0:40:51.279
<v Speaker 1>the width of the graph the breadth of it. Both

0:40:51.360 --> 0:40:54.720
<v Speaker 1>are valid forms of searching, and the method used typically

0:40:54.719 --> 0:40:57.319
<v Speaker 1>depends upon the type of data being searched and what

0:40:57.360 --> 0:41:00.040
<v Speaker 1>you're trying to do. We've got a lot more to

0:41:00.120 --> 0:41:03.799
<v Speaker 1>cover with algorithms, but I feel like I'm gonna have

0:41:03.960 --> 0:41:07.799
<v Speaker 1>to give you guys a break, So let's do that

0:41:07.840 --> 0:41:10.400
<v Speaker 1>really quick, and I'll just give you a very short

0:41:10.440 --> 0:41:14.080
<v Speaker 1>example following, and then we'll pick up back up with

0:41:14.080 --> 0:41:17.000
<v Speaker 1>algorithms again in a future episode. But first let's take

0:41:17.040 --> 0:41:27.440
<v Speaker 1>this quick break, all right. I know I've waxed poetic

0:41:27.480 --> 0:41:30.400
<v Speaker 1>about algorithms so much so that this episode is running

0:41:30.440 --> 0:41:34.080
<v Speaker 1>longer than I anticipated. I have a whole extra section

0:41:34.760 --> 0:41:39.480
<v Speaker 1>to talk about with algorithms, including things that are related

0:41:39.520 --> 0:41:44.080
<v Speaker 1>to algorithms but aren't necessarily specifically algorithms, stuff like hashing

0:41:44.160 --> 0:41:47.239
<v Speaker 1>and Markov models and things of that nature. But I

0:41:47.280 --> 0:41:49.680
<v Speaker 1>want to finish up with one that I think is

0:41:49.760 --> 0:41:53.560
<v Speaker 1>kind of fun. And this is called the Doomsday rule.

0:41:53.719 --> 0:41:55.600
<v Speaker 1>And to be be fair, this is not just a

0:41:55.640 --> 0:41:58.400
<v Speaker 1>computational algorithm. This is something that you can do in

0:41:58.440 --> 0:42:01.000
<v Speaker 1>your head if you learn the rule. I'm not saying

0:42:01.000 --> 0:42:03.719
<v Speaker 1>I could do it. I haven't really committed this to

0:42:05.200 --> 0:42:08.600
<v Speaker 1>a memory process yet, but it is possible. And the

0:42:08.640 --> 0:42:12.759
<v Speaker 1>Doomsday rule sounds pretty ominous, however, right. I mean it's

0:42:12.760 --> 0:42:15.560
<v Speaker 1>basically to figure out what day of the week any

0:42:15.719 --> 0:42:19.880
<v Speaker 1>given date is. So if you were an expert with

0:42:19.960 --> 0:42:22.799
<v Speaker 1>the doomsday rule and I asked you, hey, what day

0:42:22.800 --> 0:42:27.560
<v Speaker 1>of the week does June five fall on? You could

0:42:27.760 --> 0:42:30.600
<v Speaker 1>use that rule and say, oh, that's gonna be a Thursday.

0:42:31.040 --> 0:42:32.600
<v Speaker 1>That also, by the way, happens to be the day

0:42:32.600 --> 0:42:36.279
<v Speaker 1>I'll turn fifty. Yikes, man, we're coming up on that one.

0:42:36.320 --> 0:42:40.399
<v Speaker 1>All right, So where did this rule come from? And

0:42:40.440 --> 0:42:43.239
<v Speaker 1>what the heck is this doomsday stuff about? Well, the

0:42:43.239 --> 0:42:46.080
<v Speaker 1>doomsday thing is kind of just a cheeky name, and

0:42:46.280 --> 0:42:49.319
<v Speaker 1>there's all these different ways we could describe that. But

0:42:50.239 --> 0:42:53.319
<v Speaker 1>during any given year, there are certain dates that will

0:42:53.360 --> 0:42:55.880
<v Speaker 1>always share the same day of the week, which is

0:42:55.920 --> 0:43:00.000
<v Speaker 1>no big surprise, right. I mean, you might notice that Christmas,

0:43:00.200 --> 0:43:03.160
<v Speaker 1>that is December twenty falls on the same day of

0:43:03.160 --> 0:43:06.080
<v Speaker 1>the week as New Year's Day for the following year

0:43:06.360 --> 0:43:09.600
<v Speaker 1>that happened, you know, January one. It always is that way.

0:43:09.640 --> 0:43:14.600
<v Speaker 1>But with the doomsday rule, the dates for that are

0:43:14.680 --> 0:43:18.560
<v Speaker 1>called doomsdays. Are things like April four or four four,

0:43:19.120 --> 0:43:24.000
<v Speaker 1>June six that's six six, August eight that's eight eight,

0:43:24.560 --> 0:43:27.520
<v Speaker 1>and you know, so on like October tenth, that's ten ten.

0:43:28.520 --> 0:43:32.919
<v Speaker 1>The anchor day are called these are anchor days, they're

0:43:32.920 --> 0:43:39.400
<v Speaker 1>called doomsdays. Um, they change with each year or with

0:43:39.560 --> 0:43:42.640
<v Speaker 1>leap years. The anchor day actually leaps a year. But

0:43:43.040 --> 0:43:45.080
<v Speaker 1>once you know that day. You know, it's the same

0:43:45.120 --> 0:43:48.560
<v Speaker 1>for all of those dates. So for one, as I

0:43:48.600 --> 0:43:54.279
<v Speaker 1>record this, this year's doomsday is or anchor day is

0:43:54.280 --> 0:43:56.440
<v Speaker 1>a Sunday, So that means every Doomsday is going to

0:43:56.480 --> 0:43:59.759
<v Speaker 1>be a Sunday. So I'm recording this in July with

0:44:00.320 --> 0:44:05.080
<v Speaker 1>our next doomsday being on August eight, So that means

0:44:05.120 --> 0:44:09.680
<v Speaker 1>August eight should be a Sunday. And if you look

0:44:09.680 --> 0:44:12.920
<v Speaker 1>at the calendar, you'll see that, yes, August eight is

0:44:12.960 --> 0:44:17.160
<v Speaker 1>a Sunday. That means that October tenth should be a Sunday,

0:44:17.160 --> 0:44:21.520
<v Speaker 1>that December twelve should be a Sunday. So the doomsday

0:44:21.560 --> 0:44:24.080
<v Speaker 1>rule involves a little bit more than just this, but

0:44:24.200 --> 0:44:27.000
<v Speaker 1>not much more. And this means that if you learn

0:44:27.080 --> 0:44:30.879
<v Speaker 1>the doomsday rule and you have a general idea of

0:44:30.920 --> 0:44:34.719
<v Speaker 1>what the anchor day is for each year, you can

0:44:34.800 --> 0:44:38.600
<v Speaker 1>calculate what in what day of the week any given

0:44:38.719 --> 0:44:42.879
<v Speaker 1>date will fall on, including past years. The guy who

0:44:42.920 --> 0:44:46.560
<v Speaker 1>came up with this was a mathematician named John Conway,

0:44:46.600 --> 0:44:50.160
<v Speaker 1>and reportedly he could give you an answer in less

0:44:50.160 --> 0:44:51.960
<v Speaker 1>than two seconds. If you gave him a date, he

0:44:51.960 --> 0:44:53.480
<v Speaker 1>could tell you what day of the week it was

0:44:53.480 --> 0:44:57.040
<v Speaker 1>going to fall on in two seconds or less. Sadly,

0:44:57.120 --> 0:45:00.560
<v Speaker 1>he passed away last year at the age of eighty

0:45:00.560 --> 0:45:05.279
<v Speaker 1>two after he contracted COVID nineteen. But that doomsday rule

0:45:05.360 --> 0:45:07.120
<v Speaker 1>is one that I think is super cool. I've seen

0:45:07.120 --> 0:45:08.880
<v Speaker 1>people who can do this where you give them a

0:45:08.960 --> 0:45:11.000
<v Speaker 1>date and they're just able to tell you what day

0:45:11.000 --> 0:45:13.400
<v Speaker 1>of the week that falls on, and you can go

0:45:13.440 --> 0:45:15.799
<v Speaker 1>and check it and sure enough they're right. Well, this

0:45:15.880 --> 0:45:18.520
<v Speaker 1>is one process where you can do that. It's not

0:45:18.560 --> 0:45:21.240
<v Speaker 1>the only one, by the way, there are other algorithms

0:45:21.320 --> 0:45:24.640
<v Speaker 1>that also can help you determine what day of the

0:45:24.680 --> 0:45:27.960
<v Speaker 1>week a specific date will fall on. But the doomsday

0:45:28.040 --> 0:45:31.319
<v Speaker 1>rule is is one that works. And again I don't

0:45:31.320 --> 0:45:34.319
<v Speaker 1>have it. Uh. I don't have an expertise in this.

0:45:34.480 --> 0:45:37.080
<v Speaker 1>I haven't practiced it at all, so I can't do it.

0:45:37.520 --> 0:45:39.120
<v Speaker 1>If you came up to me and said, hey, Jonathan

0:45:39.680 --> 0:45:42.960
<v Speaker 1>May first, nineteen, what day of the week was that,

0:45:42.960 --> 0:45:46.560
<v Speaker 1>I'd be like, A, I don't know. Probably A it's

0:45:46.600 --> 0:45:50.120
<v Speaker 1>probably a fine day. I don't I don't know because

0:45:50.120 --> 0:45:52.520
<v Speaker 1>I haven't done this yet. But I think it's really cool.

0:45:52.560 --> 0:45:56.239
<v Speaker 1>I gets it illustrates how for certain types of problems

0:45:56.640 --> 0:45:59.840
<v Speaker 1>you can come up with a mathematical approach to solving

0:45:59.840 --> 0:46:03.880
<v Speaker 1>the problems, and it just is applicable for all problems

0:46:03.920 --> 0:46:07.160
<v Speaker 1>that fall into that category. And that's really the elegant

0:46:07.200 --> 0:46:09.680
<v Speaker 1>and cool thing about algorithms. Also, the other cool thing

0:46:09.719 --> 0:46:11.719
<v Speaker 1>is that people are coming up with new ones all

0:46:11.800 --> 0:46:15.680
<v Speaker 1>the time, and they might be trying to refine earlier

0:46:15.719 --> 0:46:19.360
<v Speaker 1>algorithms to make them even more efficient and effective, or

0:46:19.400 --> 0:46:20.839
<v Speaker 1>they might be trying to come up with all new

0:46:20.880 --> 0:46:25.799
<v Speaker 1>algorithms to take advantage of emerging technology stuff like quantum computing.

0:46:26.200 --> 0:46:28.160
<v Speaker 1>But as I said, I'll have to do another episode

0:46:28.160 --> 0:46:31.640
<v Speaker 1>about algorithms to talk more about it, because this one

0:46:31.719 --> 0:46:33.759
<v Speaker 1>ran longer than I thought. Like I said, I've got

0:46:33.760 --> 0:46:36.600
<v Speaker 1>like three more pages of notes that I wanted to

0:46:36.600 --> 0:46:40.680
<v Speaker 1>go over, but I ran long, So we're gonna cut

0:46:40.719 --> 0:46:43.000
<v Speaker 1>this one short. But we will come back to algorithms

0:46:43.040 --> 0:46:45.480
<v Speaker 1>at some point in the future and talk about some

0:46:45.520 --> 0:46:48.560
<v Speaker 1>related stuff. I really want to talk about hashing, particularly

0:46:48.640 --> 0:46:52.279
<v Speaker 1>as it applies to stuff like bitcoin mining, because that's

0:46:52.280 --> 0:46:55.240
<v Speaker 1>a pretty big deal. If you have suggestions for topics

0:46:55.280 --> 0:46:57.839
<v Speaker 1>I should cover in tech stuff, whether it's something really

0:46:57.840 --> 0:47:01.200
<v Speaker 1>technical or maybe just a goofy thing in tech. It

0:47:01.239 --> 0:47:04.400
<v Speaker 1>could be a person in tech, a company, a specific

0:47:04.480 --> 0:47:07.200
<v Speaker 1>product and you want to know about its history and impact,

0:47:07.600 --> 0:47:10.360
<v Speaker 1>anything like that. Let me know. The best way to

0:47:10.360 --> 0:47:12.600
<v Speaker 1>get in touch with me is over on Twitter. The

0:47:12.680 --> 0:47:16.279
<v Speaker 1>handle we use is tech stuff H s W and

0:47:16.360 --> 0:47:24.640
<v Speaker 1>I'll talk to you again really soon. Tech Stuff is

0:47:24.680 --> 0:47:27.800
<v Speaker 1>an I Heart Radio production. For more podcasts from my

0:47:27.960 --> 0:47:31.560
<v Speaker 1>Heart Radio, visit the i Heart Radio app, Apple Podcasts,

0:47:31.680 --> 0:47:33.680
<v Speaker 1>or wherever you listen to your favorite shows.