1 00:00:04,400 --> 00:00:07,800 Speaker 1: Welcome to tech Stuff, a production from I Heart Radio. 2 00:00:11,880 --> 00:00:14,200 Speaker 1: Hey there, and welcome to tech Stuff. I'm your host, 3 00:00:14,320 --> 00:00:16,760 Speaker 1: Jonathan Strickland. I'm an executive producer with I Heart Radio. 4 00:00:16,840 --> 00:00:19,600 Speaker 1: And how the tech are you. I'm not doing so 5 00:00:19,640 --> 00:00:22,599 Speaker 1: great myself right now. I'm running a low fever. I'm 6 00:00:22,600 --> 00:00:24,919 Speaker 1: hoping that I just have like a stomach bug or 7 00:00:24,960 --> 00:00:27,320 Speaker 1: something and that it's not a second case of COVID, 8 00:00:27,360 --> 00:00:29,960 Speaker 1: because I don't want to be that guy. Uh. And 9 00:00:30,160 --> 00:00:32,080 Speaker 1: that's a good reminder that if you are in an 10 00:00:32,120 --> 00:00:35,599 Speaker 1: area where the COVID numbers have not really slacked off, 11 00:00:36,320 --> 00:00:38,280 Speaker 1: still a good idea to wear a mask, you know, 12 00:00:38,360 --> 00:00:42,520 Speaker 1: limit your exposure to other folks. Seriously, this is no fun. 13 00:00:42,600 --> 00:00:43,919 Speaker 1: You don't want to go through it if you can 14 00:00:43,960 --> 00:00:47,080 Speaker 1: avoid it. So yeah, just you know, I care about 15 00:00:47,080 --> 00:00:50,760 Speaker 1: you guys, so take care of yourself. Also, you know 16 00:00:51,280 --> 00:00:53,640 Speaker 1: that means that I'm not really able to write a 17 00:00:53,640 --> 00:00:56,640 Speaker 1: new episode because I can't read good when I got 18 00:00:56,640 --> 00:00:59,360 Speaker 1: a fever. So we're gonna have a little bit of 19 00:00:59,360 --> 00:01:01,680 Speaker 1: a rerun. I apologize for that. I wish I could 20 00:01:01,720 --> 00:01:04,480 Speaker 1: avoid it, I really do. But I also feel like 21 00:01:04,480 --> 00:01:07,080 Speaker 1: this is an episode that is timeless. It's one that 22 00:01:07,240 --> 00:01:10,240 Speaker 1: is important. It's called what Is an Algorithm? Which originally 23 00:01:10,280 --> 00:01:13,759 Speaker 1: published last year on July twenty one, And the reason 24 00:01:13,760 --> 00:01:16,280 Speaker 1: why I think it's important is that a lot of 25 00:01:16,280 --> 00:01:20,280 Speaker 1: people know the word algorithm, but they don't have a 26 00:01:20,280 --> 00:01:23,000 Speaker 1: deeper appreciation of what that actually means. We almost just 27 00:01:23,080 --> 00:01:26,400 Speaker 1: use it as a placeholder. It might as well be magic, right. 28 00:01:26,680 --> 00:01:29,800 Speaker 1: The Facebook algorithm determines what you see and what you 29 00:01:29,880 --> 00:01:34,160 Speaker 1: don't see, but that doesn't really explain what an algorithm is. 30 00:01:34,280 --> 00:01:37,920 Speaker 1: So I hope that you find this episode interesting and 31 00:01:38,240 --> 00:01:41,520 Speaker 1: if you would like to leave a suggestion for an 32 00:01:41,520 --> 00:01:43,440 Speaker 1: episode topic for me in the future. There are a 33 00:01:43,440 --> 00:01:45,280 Speaker 1: couple different ways of doing it. One is you can 34 00:01:45,280 --> 00:01:48,360 Speaker 1: go over to the I Heart Radio podcast app, which 35 00:01:48,400 --> 00:01:50,680 Speaker 1: is free. You can just navigate over to the tech 36 00:01:50,720 --> 00:01:54,320 Speaker 1: stuff page and there is a little microphone icon which 37 00:01:54,360 --> 00:01:56,520 Speaker 1: allows you to leave a talk back message up to 38 00:01:56,720 --> 00:01:59,200 Speaker 1: thirty seconds in length, so you can always leave me 39 00:01:59,240 --> 00:02:01,800 Speaker 1: a message if you like. You can indicate if I 40 00:02:01,840 --> 00:02:05,000 Speaker 1: could use the audio in an upcoming episode, which would 41 00:02:05,040 --> 00:02:06,840 Speaker 1: be a lot of fun. But I'm not gonna just 42 00:02:06,880 --> 00:02:09,240 Speaker 1: assume that you're cool with that. You'll have to tell me. 43 00:02:09,880 --> 00:02:11,839 Speaker 1: And um, A lot of people have been doing that. 44 00:02:11,919 --> 00:02:14,440 Speaker 1: They've been leaving messages. It's been great. You've all been 45 00:02:14,560 --> 00:02:18,040 Speaker 1: so kind and so enthusiastic, and I love it. Keep 46 00:02:18,120 --> 00:02:20,560 Speaker 1: them coming. Also, if you don't want to use the app, 47 00:02:20,600 --> 00:02:22,679 Speaker 1: I totally get it. You can always leave me a 48 00:02:22,720 --> 00:02:24,880 Speaker 1: message on Twitter. The handle for the show is tech 49 00:02:24,960 --> 00:02:28,600 Speaker 1: Stuff hs W. Now let's get to this episode that 50 00:02:28,639 --> 00:02:32,160 Speaker 1: originally published July twenty one, two thousand twenty one. What 51 00:02:32,560 --> 00:02:39,560 Speaker 1: is an algorithm? I frequently speak about algorithms on the show. 52 00:02:39,639 --> 00:02:42,880 Speaker 1: I talked about them all the time, about Facebook's algorithm 53 00:02:43,000 --> 00:02:47,760 Speaker 1: or YouTube's algorithm. We talk about search algorithms and recommendation 54 00:02:47,840 --> 00:02:51,840 Speaker 1: algorithms and tons of others. But I haven't really spent 55 00:02:52,040 --> 00:02:55,800 Speaker 1: a ton of time talking about what algorithms actually are. 56 00:02:56,240 --> 00:03:01,000 Speaker 1: Like it kind of become shorthand for do not look 57 00:03:01,040 --> 00:03:03,760 Speaker 1: behind the curtain, right, It doesn't really help you if 58 00:03:03,760 --> 00:03:07,000 Speaker 1: you don't know more about it. Uh. I might go 59 00:03:07,120 --> 00:03:08,960 Speaker 1: as far as to say it's a set of rules 60 00:03:09,040 --> 00:03:12,240 Speaker 1: or instructions to carry out a task, but that's pretty 61 00:03:12,280 --> 00:03:15,720 Speaker 1: reductive and it doesn't really help you understand what algorithms 62 00:03:15,760 --> 00:03:18,800 Speaker 1: actually do. So today I thought we'd talk a little 63 00:03:18,800 --> 00:03:21,960 Speaker 1: bit about algorithms and what they do in general, and 64 00:03:22,000 --> 00:03:25,160 Speaker 1: then maybe chat about a few famous examples and some fun, 65 00:03:25,280 --> 00:03:29,560 Speaker 1: little quirky stuff. So before I dive into this, we 66 00:03:29,680 --> 00:03:34,320 Speaker 1: do need to establish a few things, and arguably the 67 00:03:34,360 --> 00:03:37,360 Speaker 1: most important of those things is that I am not 68 00:03:37,440 --> 00:03:41,840 Speaker 1: a mathematician. I am not a computer scientist. I'm a 69 00:03:41,840 --> 00:03:46,000 Speaker 1: guy who loves tech, and I'm decent at research, and 70 00:03:46,120 --> 00:03:50,000 Speaker 1: I do my best to communicate topics in an informative 71 00:03:50,160 --> 00:03:53,160 Speaker 1: and you know, on a good day and entertaining way. 72 00:03:53,600 --> 00:03:56,560 Speaker 1: So with that in mind, I fully admit that this 73 00:03:56,640 --> 00:04:00,720 Speaker 1: is a subject that is outside of my narrow expertise, 74 00:04:01,200 --> 00:04:04,360 Speaker 1: and so my descriptions and explanations will be from a 75 00:04:04,480 --> 00:04:08,480 Speaker 1: very high level. Uh. And you might even be able 76 00:04:08,520 --> 00:04:11,400 Speaker 1: to get something like this just by glancing at a 77 00:04:11,480 --> 00:04:18,039 Speaker 1: pamphlet that's about a computer science introductory course. So for 78 00:04:18,120 --> 00:04:19,719 Speaker 1: all you folks out there who are deep in the 79 00:04:19,720 --> 00:04:23,320 Speaker 1: computer sciences, this is going to be like a children's 80 00:04:23,440 --> 00:04:27,320 Speaker 1: story book for you, possibly one where you don't like 81 00:04:27,400 --> 00:04:31,479 Speaker 1: de illustrations very much. Another thing that I need to 82 00:04:31,600 --> 00:04:35,960 Speaker 1: establish is that algorithm itself is a very broad term, 83 00:04:36,720 --> 00:04:39,359 Speaker 1: you know, in that sense, it's kind of like the 84 00:04:39,400 --> 00:04:44,440 Speaker 1: word program or app or software, and that these words 85 00:04:44,520 --> 00:04:49,000 Speaker 1: are categories that can have a wide variety of specific instances. 86 00:04:49,279 --> 00:04:52,360 Speaker 1: For example, let's just take a look at software. If 87 00:04:52,360 --> 00:04:55,640 Speaker 1: I'm talking about software, I could be talking about a 88 00:04:55,760 --> 00:05:00,120 Speaker 1: very simple program that serves as a basic calculator that 89 00:05:00,200 --> 00:05:04,680 Speaker 1: can add and subtract and divide and multiply. That could 90 00:05:04,760 --> 00:05:06,960 Speaker 1: be a piece of software, be a very simple one. 91 00:05:07,640 --> 00:05:10,040 Speaker 1: Or I might talk about something a little more complicated, 92 00:05:10,120 --> 00:05:13,960 Speaker 1: like a word processing program. Or I could talk about 93 00:05:14,040 --> 00:05:18,960 Speaker 1: an advanced three D shooter video game, or an incredibly 94 00:05:19,080 --> 00:05:23,800 Speaker 1: complicated computer simulation program, or anything in between. All of 95 00:05:23,839 --> 00:05:27,280 Speaker 1: those could fall into the realm of software well. Algorithms 96 00:05:27,720 --> 00:05:32,680 Speaker 1: similarly come in a wide variety of functions and complexity. 97 00:05:32,720 --> 00:05:35,800 Speaker 1: There are some that are elegant in their simplicity, and 98 00:05:35,839 --> 00:05:38,839 Speaker 1: there are some that when I look at them written 99 00:05:38,839 --> 00:05:46,160 Speaker 1: out in in what is clearly well defined terminology, uh, 100 00:05:46,240 --> 00:05:49,040 Speaker 1: I'm just left wondering what the heck it is I 101 00:05:49,080 --> 00:05:51,640 Speaker 1: just saw. They might as well be hieroglyphics to me. 102 00:05:51,680 --> 00:05:54,760 Speaker 1: In other words, but let's start off by talking about 103 00:05:54,839 --> 00:06:00,599 Speaker 1: the word algorithm itself. Now, unlike a lot of words 104 00:06:01,040 --> 00:06:05,599 Speaker 1: that we use specifically in English, algorithm does not have 105 00:06:05,760 --> 00:06:10,440 Speaker 1: its roots in Latin vocabulary. There are words in Latin 106 00:06:10,520 --> 00:06:13,200 Speaker 1: that are like al gore and things like that, but 107 00:06:13,320 --> 00:06:17,719 Speaker 1: that's not where algorithm comes from. Instead, it's a Latinized 108 00:06:18,040 --> 00:06:23,840 Speaker 1: version of an Arabic name. Algorithm comes from algorithmic, which 109 00:06:23,880 --> 00:06:26,640 Speaker 1: is the name that Latin scholars gave to a brilliant 110 00:06:26,880 --> 00:06:31,359 Speaker 1: man named al Ka Ritzmy and my apologies for the 111 00:06:31,440 --> 00:06:35,680 Speaker 1: butchering of the pronunciation of that name. No disrespect is intended. 112 00:06:36,400 --> 00:06:43,760 Speaker 1: It's merely American ignorance anyway. This particular mathematician philosophers scholar 113 00:06:44,360 --> 00:06:48,159 Speaker 1: served as a very important astronomer and librarian in Baghdad 114 00:06:48,520 --> 00:06:53,360 Speaker 1: in the ninth century. His work in mathematics was truly foundational, 115 00:06:53,880 --> 00:06:57,600 Speaker 1: so much so that we get the word algebra from 116 00:06:57,640 --> 00:07:01,680 Speaker 1: a work that he published. He treated algebra as a 117 00:07:01,760 --> 00:07:05,120 Speaker 1: distinct branch of mathematics, when before it was just kind 118 00:07:05,120 --> 00:07:07,440 Speaker 1: of lumped in with other stuff. And he did a 119 00:07:07,440 --> 00:07:11,000 Speaker 1: lot of work and showing how to work various types 120 00:07:11,000 --> 00:07:13,600 Speaker 1: of equations and how to balance equations. And on a 121 00:07:13,680 --> 00:07:17,559 Speaker 1: personal note, this was something that I used to love 122 00:07:17,600 --> 00:07:20,400 Speaker 1: to do in my mathematics courses. I could really see 123 00:07:20,400 --> 00:07:23,800 Speaker 1: the beauty in determining if two sides of an equation 124 00:07:24,280 --> 00:07:27,880 Speaker 1: truly were equal. It was like an elegant puzzle, and 125 00:07:27,880 --> 00:07:30,440 Speaker 1: I really love that. But again, just to be clear, 126 00:07:30,560 --> 00:07:33,520 Speaker 1: my love of algebra and trigonometry is pretty much where 127 00:07:33,960 --> 00:07:37,120 Speaker 1: math and I parted ways, because when calculus came along, 128 00:07:37,640 --> 00:07:40,400 Speaker 1: I was I was pretty much done. So at that 129 00:07:40,440 --> 00:07:45,880 Speaker 1: point it was it was beyond my ken as they say. Anyway, 130 00:07:46,240 --> 00:07:50,000 Speaker 1: back to our Arabic scholar, he highlighted the importance and 131 00:07:50,040 --> 00:07:56,080 Speaker 1: effectiveness of using a methodical approach towards the solution of problems, 132 00:07:56,280 --> 00:07:59,480 Speaker 1: and that kind of gets at the heart of what 133 00:07:59,720 --> 00:08:04,440 Speaker 1: our gorhythms actually are. The basic definition, which I kind 134 00:08:04,440 --> 00:08:08,440 Speaker 1: of alluded to earlier is quote a process or set 135 00:08:08,560 --> 00:08:12,520 Speaker 1: of rules to be followed in calculations or other problems 136 00:08:12,520 --> 00:08:17,360 Speaker 1: solving operations, especially by a computer. End quote that's from 137 00:08:17,400 --> 00:08:21,120 Speaker 1: Oxford Languages. But you know this can apply to all 138 00:08:21,120 --> 00:08:23,960 Speaker 1: sorts of stuff. For example, if you've ever seen anyone 139 00:08:24,400 --> 00:08:28,400 Speaker 1: who can solve Rubics cubes, those those puzzles that are 140 00:08:28,520 --> 00:08:31,080 Speaker 1: in cube form where you've got all the little, uh 141 00:08:31,240 --> 00:08:33,320 Speaker 1: different colors of squares and your job is to make 142 00:08:33,760 --> 00:08:37,880 Speaker 1: each side of the cube the same color. Well, there 143 00:08:37,880 --> 00:08:40,880 Speaker 1: are people who can solve Rubik's cubes in in a 144 00:08:41,080 --> 00:08:44,040 Speaker 1: fraction of like, like less than a minute. It's it's 145 00:08:44,080 --> 00:08:46,920 Speaker 1: amazing to watch them go. It's so fast and it's 146 00:08:46,960 --> 00:08:49,600 Speaker 1: hard to keep up with what they're doing. They are 147 00:08:49,720 --> 00:08:56,280 Speaker 1: essentially following algorithms, these processes that will get to a 148 00:08:56,360 --> 00:09:02,640 Speaker 1: dependable and replicable outcome based on what you're doing. Um So, 149 00:09:02,679 --> 00:09:04,839 Speaker 1: an algorithm is really just a way for us to 150 00:09:05,200 --> 00:09:08,600 Speaker 1: problem solve. Let's say we have a particular outcome that 151 00:09:08,679 --> 00:09:12,120 Speaker 1: we want to achieve. The algorithm is the recipe that 152 00:09:12,160 --> 00:09:15,240 Speaker 1: we followed to go from whatever our starting condition is 153 00:09:15,360 --> 00:09:19,000 Speaker 1: our starting state. In order to get to the outcome 154 00:09:19,080 --> 00:09:22,080 Speaker 1: we want to our target state, it needs to be 155 00:09:22,559 --> 00:09:25,760 Speaker 1: well defined. Algorithms have to be well defined because computers 156 00:09:25,760 --> 00:09:30,439 Speaker 1: are not really capable of implementing vague instructions. It needs 157 00:09:30,440 --> 00:09:33,600 Speaker 1: to have a pretty solid approach so that the computer, 158 00:09:33,720 --> 00:09:37,000 Speaker 1: when following the algorithm quote unquote, knows exactly what to 159 00:09:37,040 --> 00:09:41,000 Speaker 1: do based upon the current state of the problem. It 160 00:09:41,040 --> 00:09:44,640 Speaker 1: also needs to be finite. Computers are not capable of 161 00:09:44,800 --> 00:09:49,200 Speaker 1: handling infinite possibilities, so the algorithm has to work within 162 00:09:49,280 --> 00:09:53,200 Speaker 1: certain parameters, and those parameters depend upon the nature of 163 00:09:53,240 --> 00:09:56,160 Speaker 1: the problem you're trying to solve. And the equipment that 164 00:09:56,240 --> 00:09:59,240 Speaker 1: you have to solve it with. So let's take a 165 00:09:59,320 --> 00:10:04,120 Speaker 1: problem that computers typically struggle to achieve, and that is 166 00:10:04,360 --> 00:10:08,720 Speaker 1: random number generation or r in G. Now you would 167 00:10:08,760 --> 00:10:13,000 Speaker 1: think that creating a random number would be easy. I mean, 168 00:10:13,040 --> 00:10:16,600 Speaker 1: we can do it just by throwing some dice for example, Right, 169 00:10:16,640 --> 00:10:19,000 Speaker 1: you can throw a die and and whatever the number 170 00:10:19,280 --> 00:10:23,080 Speaker 1: comes up, that's your random number. But computers have to 171 00:10:23,120 --> 00:10:28,280 Speaker 1: follow specific instructions and execute operations that by definition need 172 00:10:28,360 --> 00:10:32,120 Speaker 1: to have a predictable and replicable outcomes. So computers find 173 00:10:32,200 --> 00:10:37,160 Speaker 1: random number generation really tricky. Typically, the best we can 174 00:10:37,240 --> 00:10:40,280 Speaker 1: hope for when it comes down to this sort of 175 00:10:40,320 --> 00:10:44,360 Speaker 1: thing is pseudo random numbers. So these are numbers that, 176 00:10:44,480 --> 00:10:48,200 Speaker 1: to an extent, appear to be random, right Like, on 177 00:10:48,440 --> 00:10:53,640 Speaker 1: casual observation, it looks like the computer is generating random numbers. However, 178 00:10:53,679 --> 00:10:57,440 Speaker 1: if you were to really seriously dig down into the process, 179 00:10:57,880 --> 00:11:00,840 Speaker 1: you might discover that they are not really really random 180 00:11:00,880 --> 00:11:04,480 Speaker 1: at all. But we just need them to be random enough, right. 181 00:11:04,559 --> 00:11:07,440 Speaker 1: We need it to be close enough to seeming to 182 00:11:07,480 --> 00:11:10,200 Speaker 1: be random for it to fulfill the function we need 183 00:11:10,600 --> 00:11:13,719 Speaker 1: if it's not truly random. For a lot of applications 184 00:11:14,280 --> 00:11:19,040 Speaker 1: that ends up being, you know, negligible. On a related note, 185 00:11:19,440 --> 00:11:22,640 Speaker 1: there are some types of mathematical problems that have many 186 00:11:22,679 --> 00:11:27,000 Speaker 1: degrees of freedom lots of variables, for example. So a 187 00:11:27,080 --> 00:11:29,079 Speaker 1: problem that does have a lot of variables could have 188 00:11:29,080 --> 00:11:31,679 Speaker 1: a lot of potential solutions, and so it could be 189 00:11:31,720 --> 00:11:35,200 Speaker 1: a challenge for computers to solve. We need algorithms to 190 00:11:35,200 --> 00:11:38,760 Speaker 1: tackle these sorts of problems, to go at them in 191 00:11:38,800 --> 00:11:43,960 Speaker 1: ways that go beyond deterministic computation, which I guess I 192 00:11:44,000 --> 00:11:48,880 Speaker 1: should define that. So, deterministic computation refers to a process 193 00:11:48,920 --> 00:11:53,720 Speaker 1: in which each successive state of an operation depends completely 194 00:11:53,800 --> 00:11:58,360 Speaker 1: on the previous state. So what comes next always depends 195 00:11:58,440 --> 00:12:01,840 Speaker 1: upon what came just before. And I'll give you an example. 196 00:12:02,160 --> 00:12:03,840 Speaker 1: Let's say I give you a math problem, and I 197 00:12:03,920 --> 00:12:06,439 Speaker 1: say you need to add these two numbers together. And 198 00:12:06,520 --> 00:12:10,120 Speaker 1: let's say it's like, uh, five and six, and then 199 00:12:10,320 --> 00:12:13,800 Speaker 1: from the sum of those numbers you have to subtract four. Well, 200 00:12:14,000 --> 00:12:16,680 Speaker 1: you would first add those two numbers together, so five 201 00:12:16,720 --> 00:12:19,880 Speaker 1: plus six you got eleven, and then you would subtract 202 00:12:20,440 --> 00:12:24,960 Speaker 1: four from that number, and so eleven minus four equal seven. 203 00:12:25,559 --> 00:12:28,880 Speaker 1: And this process is deterministic because I gave you those 204 00:12:28,880 --> 00:12:34,319 Speaker 1: specific instructions that computers do really well with deterministic processes. 205 00:12:34,400 --> 00:12:38,160 Speaker 1: These are pretty easy to follow. These sorts of processes 206 00:12:38,200 --> 00:12:41,880 Speaker 1: are by their nature replicable. So in other words, if 207 00:12:41,920 --> 00:12:44,959 Speaker 1: I ask you to do that same operation, if I 208 00:12:45,000 --> 00:12:48,200 Speaker 1: tell you add five and six together and then subtract four, 209 00:12:49,080 --> 00:12:51,120 Speaker 1: it doesn't matter how many times you are you do 210 00:12:51,240 --> 00:12:53,679 Speaker 1: that that process, right, You're always going to come out 211 00:12:54,280 --> 00:12:56,560 Speaker 1: with the same answer. It's always going to come back 212 00:12:56,920 --> 00:13:00,480 Speaker 1: no matter what you do, You're gonna always of seven 213 00:13:00,480 --> 00:13:04,160 Speaker 1: as your answer, just based on that same input. So 214 00:13:04,559 --> 00:13:08,560 Speaker 1: there are a family of algorithms that collectively get the 215 00:13:08,640 --> 00:13:13,400 Speaker 1: name Monte Carlo algorithms, and they're named after Monte Carlo, 216 00:13:13,640 --> 00:13:16,120 Speaker 1: the area of Monaco that is famous for being the 217 00:13:16,160 --> 00:13:20,199 Speaker 1: location of lots of high end casinos have been there. 218 00:13:20,679 --> 00:13:24,800 Speaker 1: It's not really my jam, but it is pretty darn flashy. 219 00:13:24,920 --> 00:13:29,280 Speaker 1: So the reason these algorithms get the name Monte Carlo 220 00:13:29,360 --> 00:13:34,120 Speaker 1: algorithms is that, like gambling, they deal with an element 221 00:13:34,200 --> 00:13:39,400 Speaker 1: of randomization. So gambling is called gambling because you're taking 222 00:13:39,400 --> 00:13:43,480 Speaker 1: a risk. You're gambling, you're betting that you're gonna beat 223 00:13:43,520 --> 00:13:46,120 Speaker 1: the odds in whichever game it is that you're playing. 224 00:13:46,240 --> 00:13:49,160 Speaker 1: And that you're going to achieve an outcome that's favorable 225 00:13:49,200 --> 00:13:52,839 Speaker 1: to you, which you experience as a payout. So, whether 226 00:13:52,880 --> 00:13:56,440 Speaker 1: it's throwing dice or playing a card game, or placing 227 00:13:56,440 --> 00:14:00,000 Speaker 1: bets at a roulette wheel or playing a slot machine, 228 00:14:00,040 --> 00:14:02,560 Speaker 1: you are engaged in an activity in which there is 229 00:14:02,800 --> 00:14:06,480 Speaker 1: some element of chance, at least in theory if the 230 00:14:06,520 --> 00:14:09,720 Speaker 1: game is honest, and what you're hoping for is that 231 00:14:10,120 --> 00:14:16,160 Speaker 1: chance lands in your favor. Similarly, Monte Carlo algorithms often 232 00:14:16,200 --> 00:14:19,920 Speaker 1: focus on chance and risk assessments such as what are 233 00:14:19,920 --> 00:14:23,760 Speaker 1: the odds that if I do this one thing, I'm 234 00:14:23,760 --> 00:14:27,560 Speaker 1: gonna totally regret doing it later? But you know, more 235 00:14:27,600 --> 00:14:31,720 Speaker 1: of the a computational problem and not a lifestyle choice. Well, 236 00:14:31,760 --> 00:14:37,680 Speaker 1: back in ninet, scientists at the Los Alamos Scientific Laboratory, 237 00:14:37,840 --> 00:14:41,800 Speaker 1: including John von Neumann, uh stand All Lam and Nick 238 00:14:41,880 --> 00:14:46,479 Speaker 1: Metropolis propose what would become known as the Metropolis algorithm, 239 00:14:46,680 --> 00:14:50,320 Speaker 1: one of the Monte Carlo algorithms, and the purpose of 240 00:14:50,320 --> 00:14:55,960 Speaker 1: this algorithm was to approximate solutions two very complicated mathematical 241 00:14:56,040 --> 00:15:01,480 Speaker 1: problems where going through a deterministic approach to find the 242 00:15:01,520 --> 00:15:05,080 Speaker 1: definitive answer just wasn't feasible. So In other words, for 243 00:15:05,240 --> 00:15:09,000 Speaker 1: certain complicated math problems, figuring out the quote unquote real 244 00:15:09,200 --> 00:15:12,440 Speaker 1: answer would really just take too long, perhaps to the 245 00:15:12,440 --> 00:15:15,239 Speaker 1: point where you would never get there within your lifetime. 246 00:15:15,560 --> 00:15:17,440 Speaker 1: So you need a way to kind of get a 247 00:15:17,480 --> 00:15:22,360 Speaker 1: ballpark solution that hopefully is closer to being correct than incorrect. 248 00:15:23,320 --> 00:15:25,360 Speaker 1: Doesn't sound like the sort of thing that computers would 249 00:15:25,360 --> 00:15:27,640 Speaker 1: be particularly good at doing right off the bat, right. 250 00:15:28,240 --> 00:15:33,040 Speaker 1: In fact, the algorithm allows computers to mimic a randomized process, 251 00:15:33,320 --> 00:15:37,400 Speaker 1: so it's not truly random, but it's random ish if 252 00:15:37,440 --> 00:15:40,400 Speaker 1: you like, and it uses this to approximate a solution 253 00:15:40,480 --> 00:15:43,200 Speaker 1: to whatever the problem is that you're trying to solve 254 00:15:43,240 --> 00:15:46,920 Speaker 1: that falls into this category. I once saw a simulation 255 00:15:47,280 --> 00:15:51,120 Speaker 1: of a randomized process using the Monte Carlo method that 256 00:15:51,200 --> 00:15:55,000 Speaker 1: I thought was pretty nifty, and it was determining what 257 00:15:55,160 --> 00:15:57,360 Speaker 1: is the value of pie. Let's say that you don't 258 00:15:57,440 --> 00:16:00,800 Speaker 1: know the value of pie and you're just trying to 259 00:16:00,840 --> 00:16:03,000 Speaker 1: figure it out. So and by the way, I mean 260 00:16:03,040 --> 00:16:05,400 Speaker 1: pie is in p I not as in the delicious 261 00:16:06,000 --> 00:16:10,160 Speaker 1: pie dessert treat. So here's the scenario. Imagine that you've 262 00:16:10,200 --> 00:16:12,600 Speaker 1: got a table and the tables like, I don't know, 263 00:16:13,120 --> 00:16:17,000 Speaker 1: three ft to a side, and positioned over this table 264 00:16:17,120 --> 00:16:20,280 Speaker 1: is a robotic arm. And this robotic arm can pick 265 00:16:20,400 --> 00:16:24,920 Speaker 1: up and drop large ball bearings onto the table, and 266 00:16:25,200 --> 00:16:27,720 Speaker 1: the arm can just move over the entire region of 267 00:16:27,760 --> 00:16:29,560 Speaker 1: the table, so it's got a three ft by three 268 00:16:29,640 --> 00:16:34,040 Speaker 1: ft range of motion. And in on this table you 269 00:16:34,200 --> 00:16:38,080 Speaker 1: set down two containers. You've got one that's that's a 270 00:16:38,080 --> 00:16:42,920 Speaker 1: circular container and one that's square. And the square container 271 00:16:43,040 --> 00:16:47,400 Speaker 1: measures six inches to a side. The radius of the 272 00:16:47,480 --> 00:16:50,840 Speaker 1: circular container is also six inches, so that means it's 273 00:16:50,840 --> 00:16:55,080 Speaker 1: got a twelve inch diameter. Right, So those are your containers, 274 00:16:55,520 --> 00:16:58,440 Speaker 1: and you've got your situation with your your robot arm 275 00:16:58,720 --> 00:17:02,280 Speaker 1: above this three ft square table. So the robotic arms 276 00:17:02,360 --> 00:17:06,680 Speaker 1: job is to pick up ball bearings and then from 277 00:17:06,680 --> 00:17:10,879 Speaker 1: a random que will drop that ball bearing somewhere above 278 00:17:10,960 --> 00:17:13,600 Speaker 1: the table. So some of those balls are going to 279 00:17:13,680 --> 00:17:16,280 Speaker 1: fall into the square container, some of them are going 280 00:17:16,320 --> 00:17:19,040 Speaker 1: to fall into the round container, some of them are 281 00:17:19,040 --> 00:17:22,200 Speaker 1: not going to fall in either. And if the process 282 00:17:22,320 --> 00:17:25,760 Speaker 1: is truly random, meaning there's an equal chance that it 283 00:17:25,800 --> 00:17:28,679 Speaker 1: will drop a ball bearing over any given point of 284 00:17:28,720 --> 00:17:32,480 Speaker 1: that table, over time, we would expect to see more 285 00:17:32,520 --> 00:17:36,119 Speaker 1: ball bearings fall into the round container because it has 286 00:17:36,160 --> 00:17:39,800 Speaker 1: a greater area and there's more space for a ball 287 00:17:39,840 --> 00:17:43,120 Speaker 1: bearing to fall into one of these. At the end 288 00:17:43,119 --> 00:17:47,240 Speaker 1: of repeating this process many, many times, we should be 289 00:17:47,320 --> 00:17:50,600 Speaker 1: able to take these two containers and then count the 290 00:17:50,680 --> 00:17:53,600 Speaker 1: number of ball bearings in each of them. And if 291 00:17:53,640 --> 00:17:56,919 Speaker 1: we divide the number of ball bearings in the circular 292 00:17:57,000 --> 00:17:59,920 Speaker 1: container by the number of ball bearings that fell into 293 00:18:00,040 --> 00:18:03,399 Speaker 1: the square container, we're gonna get results that should be 294 00:18:03,640 --> 00:18:09,920 Speaker 1: really close to pie. And you might think, wait, why 295 00:18:09,960 --> 00:18:13,160 Speaker 1: why would the number of ball bearings in one container 296 00:18:13,280 --> 00:18:17,520 Speaker 1: versus another, and then dividing those why would you get pie? Well, 297 00:18:17,560 --> 00:18:21,280 Speaker 1: if you have a process that is uniformly random across 298 00:18:21,320 --> 00:18:24,879 Speaker 1: an area, like our hypothetical three ft square table, the 299 00:18:24,960 --> 00:18:28,560 Speaker 1: probability that a dropped ball bearing will land in one 300 00:18:28,600 --> 00:18:32,879 Speaker 1: of those two specific containers is proportional to that specific 301 00:18:32,920 --> 00:18:37,439 Speaker 1: containers area or cross section. So then we just ask, all, right, well, 302 00:18:37,440 --> 00:18:39,800 Speaker 1: how do we define area? Well, with the square, it's 303 00:18:39,840 --> 00:18:42,360 Speaker 1: really simple, right. We take one side of a square 304 00:18:42,880 --> 00:18:45,840 Speaker 1: in this case, it's six inches, and we multiply it 305 00:18:45,880 --> 00:18:48,760 Speaker 1: by itself six times six. Because all sides of a 306 00:18:48,800 --> 00:18:50,960 Speaker 1: square are equal, we know that the length and the 307 00:18:51,000 --> 00:18:53,480 Speaker 1: width are each going to be six inches. We multiply 308 00:18:53,520 --> 00:18:56,720 Speaker 1: those together. We get thirty six square inches. That is 309 00:18:56,760 --> 00:19:00,520 Speaker 1: the area or cross section of our square container. But 310 00:19:00,640 --> 00:19:04,639 Speaker 1: for our circular container, we take the radius, which again 311 00:19:05,000 --> 00:19:07,600 Speaker 1: this case, the radius is six inches, and we square 312 00:19:07,640 --> 00:19:12,360 Speaker 1: it and then we multiply that number by pie. So 313 00:19:12,680 --> 00:19:17,200 Speaker 1: area for the circular container is six times six squared 314 00:19:17,359 --> 00:19:20,679 Speaker 1: times pie. And if we divide the cross section of 315 00:19:20,720 --> 00:19:24,680 Speaker 1: the circular container by the cross section of the square container, 316 00:19:25,320 --> 00:19:29,879 Speaker 1: the two six squared you know, the two elements the 317 00:19:29,960 --> 00:19:32,840 Speaker 1: squared elements cancel each other out, and so all we're 318 00:19:32,920 --> 00:19:36,600 Speaker 1: left with is pie. So the end result is that 319 00:19:36,680 --> 00:19:39,760 Speaker 1: when we count up these ball bearings that have landed 320 00:19:39,840 --> 00:19:43,960 Speaker 1: randomly in these containers, that that difference, the division that 321 00:19:44,040 --> 00:19:48,000 Speaker 1: we get that should be a close approximation of pie. 322 00:19:48,040 --> 00:19:50,520 Speaker 1: Now it's not going to be precise. Chances are the 323 00:19:50,600 --> 00:19:53,119 Speaker 1: number of ball bearings in the two containers will just 324 00:19:53,200 --> 00:19:56,600 Speaker 1: get you close to pie. But it illustrates how a 325 00:19:56,720 --> 00:20:01,080 Speaker 1: randomized process can help you get to a particular solution 326 00:20:01,119 --> 00:20:05,040 Speaker 1: that might otherwise be difficult to ascertain. There are videos 327 00:20:05,080 --> 00:20:08,000 Speaker 1: on YouTube that show this particular simulation. It's kind of 328 00:20:08,000 --> 00:20:10,640 Speaker 1: a famous one. So you can actually watch and get 329 00:20:10,960 --> 00:20:12,959 Speaker 1: kind of an understanding of what I said to you 330 00:20:13,000 --> 00:20:16,719 Speaker 1: makes no sense whatsoever. There are other options for you 331 00:20:16,800 --> 00:20:20,000 Speaker 1: to look into that might help, And that is a 332 00:20:20,040 --> 00:20:23,639 Speaker 1: great example. But what are the actual algorithms that fall 333 00:20:23,720 --> 00:20:27,160 Speaker 1: into the Monte Carlo methods spectrum? What are they used 334 00:20:27,160 --> 00:20:30,000 Speaker 1: to do well? They can be used to simulate things 335 00:20:30,119 --> 00:20:35,000 Speaker 1: like fluid dynamics, or cellular structures or the interaction of 336 00:20:35,080 --> 00:20:39,000 Speaker 1: disordered materials. So in other words, these are all processes. 337 00:20:39,320 --> 00:20:42,800 Speaker 1: They have a lot of potential variables at play, and 338 00:20:42,880 --> 00:20:46,480 Speaker 1: you can think of variables as representing uncertainty, something that 339 00:20:46,560 --> 00:20:50,600 Speaker 1: computers typically don't do well with. You know, from a 340 00:20:50,680 --> 00:20:57,400 Speaker 1: general stance, computers excel at specific instances rather than potential instances. 341 00:20:57,440 --> 00:21:01,760 Speaker 1: So algorithms like the Metropolis algor rhythm would lead computer 342 00:21:01,840 --> 00:21:05,840 Speaker 1: scientists to develop methodologies to kind of work around the 343 00:21:05,880 --> 00:21:11,760 Speaker 1: limitations of computers and leverage computational power and tackling very 344 00:21:11,800 --> 00:21:16,159 Speaker 1: difficult problems in that way. In the Monte Carlo family 345 00:21:16,200 --> 00:21:19,280 Speaker 1: of algorithms, we typically assume that the results we get 346 00:21:19,760 --> 00:21:23,359 Speaker 1: are going to have a potential for being wrong, like 347 00:21:23,400 --> 00:21:25,800 Speaker 1: there'll be a small percentage of error that we have 348 00:21:25,840 --> 00:21:28,520 Speaker 1: to take into account, and so keeping that in mind, 349 00:21:28,560 --> 00:21:32,199 Speaker 1: we need to frame results as being again approximations of 350 00:21:32,200 --> 00:21:35,280 Speaker 1: an answer, rather than the definitive answer to whatever problem 351 00:21:35,320 --> 00:21:38,159 Speaker 1: it is we're trying to solve. For me, this was 352 00:21:38,200 --> 00:21:40,400 Speaker 1: one of those things that was very difficult to grasp 353 00:21:40,600 --> 00:21:43,760 Speaker 1: for a long time because I was equating it to 354 00:21:44,040 --> 00:21:47,320 Speaker 1: math class, where you're supposed to get the answer. Now, 355 00:21:47,320 --> 00:21:49,440 Speaker 1: when we come back, we'll talk about a few more 356 00:21:49,560 --> 00:21:52,520 Speaker 1: famous algorithms and what they do. But first let's take 357 00:21:52,760 --> 00:22:02,960 Speaker 1: a quick break. Now. In our previous section, I talked 358 00:22:02,960 --> 00:22:05,680 Speaker 1: about a family of algorithms that trace their history back 359 00:22:05,680 --> 00:22:09,080 Speaker 1: to nineteen and so does the next one I want 360 00:22:09,119 --> 00:22:12,800 Speaker 1: to talk about, which was created by George Dantzig, who 361 00:22:12,960 --> 00:22:17,240 Speaker 1: worked for the Rand Corporation. And Danzig created a process 362 00:22:17,359 --> 00:22:20,840 Speaker 1: that would lead to what we call linear programming. So 363 00:22:21,119 --> 00:22:24,959 Speaker 1: at its most basic level, linear programming is about taking 364 00:22:25,040 --> 00:22:29,639 Speaker 1: some function and maximizing or minimizing that function with regard 365 00:22:29,720 --> 00:22:33,200 Speaker 1: to various constraints. But that is super vague, right, I mean, 366 00:22:33,240 --> 00:22:35,879 Speaker 1: it's not terribly helpful. It feels like I'm talking in 367 00:22:35,880 --> 00:22:39,520 Speaker 1: a circle. But this is one that's really important for say, 368 00:22:39,680 --> 00:22:42,960 Speaker 1: business developers. So let's talk about a slightly more specific 369 00:22:43,080 --> 00:22:46,160 Speaker 1: use case. Let's say that you are launching a business 370 00:22:46,960 --> 00:22:49,680 Speaker 1: and you're trying to make some you know, big decisions 371 00:22:49,840 --> 00:22:51,919 Speaker 1: as you're going to do this, and you're going to 372 00:22:52,240 --> 00:22:57,000 Speaker 1: manufacture and sell a product of some sort, some physical thing. Now, 373 00:22:57,040 --> 00:22:59,840 Speaker 1: your whole goal as a business is to make money 374 00:23:00,280 --> 00:23:02,919 Speaker 1: from the work you do, and to do that, you 375 00:23:02,960 --> 00:23:05,159 Speaker 1: need to figure out what your costs are going to 376 00:23:05,240 --> 00:23:09,359 Speaker 1: be and how you cannot just offset these costs but 377 00:23:09,960 --> 00:23:13,960 Speaker 1: make enough money to actually profit from it, so cover 378 00:23:14,000 --> 00:23:17,439 Speaker 1: all your costs plus some extra. So in this case, 379 00:23:17,920 --> 00:23:20,040 Speaker 1: what you're trying to do is figuring out how you 380 00:23:20,080 --> 00:23:26,200 Speaker 1: can minimize costs and maximize profits. Right. The constraints come 381 00:23:26,200 --> 00:23:29,399 Speaker 1: into play as you start to look at specifics, like 382 00:23:29,560 --> 00:23:32,760 Speaker 1: maybe you're gonna partner with a fabrication company, and maybe 383 00:23:32,760 --> 00:23:35,280 Speaker 1: you've actually got a few choices. You've got different companies 384 00:23:35,320 --> 00:23:37,720 Speaker 1: that you could go with. Well, these choices could represent 385 00:23:37,800 --> 00:23:41,600 Speaker 1: constraints in your approach. Perhaps one is more expensive than 386 00:23:41,640 --> 00:23:45,200 Speaker 1: the others, but it can produce a greater volume of product, 387 00:23:45,760 --> 00:23:48,399 Speaker 1: so you'd be able to get more product out to 388 00:23:48,480 --> 00:23:52,440 Speaker 1: market in less time. Or maybe you've got one that's 389 00:23:52,440 --> 00:23:57,320 Speaker 1: more expensive but it's also less likely to have fabrication errors, 390 00:23:57,359 --> 00:24:00,400 Speaker 1: and errors can be both costly and time can assuming 391 00:24:00,440 --> 00:24:04,320 Speaker 1: to address. So you have to quantify all these variables 392 00:24:04,400 --> 00:24:07,440 Speaker 1: and use them as constraints to start figuring out your 393 00:24:07,520 --> 00:24:11,840 Speaker 1: men maxing approach. Here, linear programming simply looks for the 394 00:24:11,880 --> 00:24:16,000 Speaker 1: optimum value of a linear expression, and depending on the 395 00:24:16,040 --> 00:24:20,560 Speaker 1: problem you're trying to solve, like maximizing profit versus minimizing costs, 396 00:24:20,800 --> 00:24:24,359 Speaker 1: you're either looking for the highest value being optimum or 397 00:24:24,400 --> 00:24:27,240 Speaker 1: the lowest value being optimum. Like with costs, you want 398 00:24:27,280 --> 00:24:29,440 Speaker 1: that to be the lowest, and you have to look 399 00:24:29,440 --> 00:24:33,159 Speaker 1: at what constraints are at play with any given expression. 400 00:24:33,720 --> 00:24:37,480 Speaker 1: So Danzing's approach to linear programming, called the simplex method, 401 00:24:37,960 --> 00:24:41,400 Speaker 1: was efficient and elegant and far more simplified than other 402 00:24:41,520 --> 00:24:45,120 Speaker 1: methodologies attempting to kind of do the same thing around 403 00:24:45,160 --> 00:24:48,160 Speaker 1: that time. But it also had some limitations, and that's 404 00:24:48,200 --> 00:24:52,400 Speaker 1: because the real world isn't as simple as math tends 405 00:24:52,480 --> 00:24:55,520 Speaker 1: to be. Like math tends to be pretty, you know, 406 00:24:56,440 --> 00:24:58,879 Speaker 1: firm in the grand scheme of things in the world 407 00:24:58,920 --> 00:25:02,160 Speaker 1: is a little more wibbly. Doubly, so, a linear programming 408 00:25:02,200 --> 00:25:06,560 Speaker 1: solution only works if the various relationships between the different 409 00:25:06,600 --> 00:25:10,040 Speaker 1: elements like the requirements and the restrictions and constraints that 410 00:25:10,080 --> 00:25:12,320 Speaker 1: you've set up with this problem. It only works if 411 00:25:12,359 --> 00:25:15,240 Speaker 1: all of those relationships are linear, or, in other words, 412 00:25:15,440 --> 00:25:18,600 Speaker 1: for a given change in one variable, we see a 413 00:25:18,720 --> 00:25:23,280 Speaker 1: given change in other variables. And that is super vague, 414 00:25:23,320 --> 00:25:25,719 Speaker 1: So we're going to talk about two variables. Will reduce 415 00:25:25,760 --> 00:25:29,120 Speaker 1: it down to that. So we'll use the classic X 416 00:25:29,160 --> 00:25:31,879 Speaker 1: and Y as our variables. Those can stand in for 417 00:25:31,920 --> 00:25:35,520 Speaker 1: all sorts of different values. And let's say that we 418 00:25:35,640 --> 00:25:38,880 Speaker 1: see there's a relationship between X and Y, and that 419 00:25:38,960 --> 00:25:43,520 Speaker 1: if the value of X changes from one to two, 420 00:25:43,960 --> 00:25:46,240 Speaker 1: we then see that the value of Y goes from 421 00:25:46,440 --> 00:25:50,000 Speaker 1: three to nine. Well, that doesn't tell us anything on 422 00:25:50,040 --> 00:25:52,920 Speaker 1: its own, right, We just know that if x is one, 423 00:25:53,440 --> 00:25:56,120 Speaker 1: y is three. If x is two, y is nine. 424 00:25:56,600 --> 00:26:00,240 Speaker 1: If we then see that if x is three, then 425 00:26:00,320 --> 00:26:04,280 Speaker 1: why is fifteen? And when x is four, why is 426 00:26:04,320 --> 00:26:09,359 Speaker 1: twenty one? We start to see a linear relationship because 427 00:26:09,400 --> 00:26:13,480 Speaker 1: each time X increases by one, why increases by six. 428 00:26:13,960 --> 00:26:18,600 Speaker 1: The rate of increase for each variable is linear. It's 429 00:26:18,640 --> 00:26:22,040 Speaker 1: it's not like the rate of increase doesn't change. So 430 00:26:22,280 --> 00:26:26,440 Speaker 1: we've got this linear relationship here. We can contrast this 431 00:26:26,560 --> 00:26:32,000 Speaker 1: with exponential relationships, in which we see not a constant increase, 432 00:26:32,320 --> 00:26:36,520 Speaker 1: but a constant ratio in successive terms in one variable 433 00:26:36,800 --> 00:26:39,920 Speaker 1: when you change another. So in this case, let's say 434 00:26:39,920 --> 00:26:42,879 Speaker 1: that we find out then, when X is one, why 435 00:26:43,000 --> 00:26:47,080 Speaker 1: is three? When X is two, why is nine? When 436 00:26:47,200 --> 00:26:50,760 Speaker 1: X is three, why is twenties seven? Now we see 437 00:26:50,800 --> 00:26:54,560 Speaker 1: that why is not increasing by six each time. We're 438 00:26:54,560 --> 00:26:59,280 Speaker 1: seeing that the value of why is multiplied by three 439 00:26:59,720 --> 00:27:02,320 Speaker 1: each time X goes up once. So we're seeing there's 440 00:27:02,320 --> 00:27:06,439 Speaker 1: a constant ratio of change with why with regard to X. 441 00:27:06,920 --> 00:27:11,200 Speaker 1: This gets into an exponential relationship. So when someone describes 442 00:27:11,280 --> 00:27:15,679 Speaker 1: something is having exponential growth, what this is supposed to 443 00:27:15,720 --> 00:27:20,560 Speaker 1: mean is that you should see a rate of growth 444 00:27:20,760 --> 00:27:25,399 Speaker 1: that is increasing by some exponent for given unit of time. 445 00:27:25,760 --> 00:27:29,000 Speaker 1: So it's not just that the thing is growing. In fact, 446 00:27:29,040 --> 00:27:32,240 Speaker 1: it's not even that the thing is growing quickly. It's 447 00:27:32,320 --> 00:27:35,880 Speaker 1: that the thing is growing faster as time goes on, 448 00:27:36,040 --> 00:27:39,800 Speaker 1: so that you would say today it's growing, you know, 449 00:27:39,880 --> 00:27:42,240 Speaker 1: say twice as fast as it was growing yesterday, and 450 00:27:42,280 --> 00:27:44,359 Speaker 1: tomorrow it will grow twice as fast as it was 451 00:27:44,440 --> 00:27:48,280 Speaker 1: growing today. And a lot of people use this phrase incorrectly. 452 00:27:48,840 --> 00:27:52,919 Speaker 1: We often really just mean yo, that thing is growing 453 00:27:53,000 --> 00:27:57,200 Speaker 1: wicked fast, but we don't necessarily mean yo, that thing 454 00:27:57,280 --> 00:27:59,840 Speaker 1: is growing wicked fast, and the rate of growth increases 455 00:27:59,840 --> 00:28:05,120 Speaker 1: by a constant amount over time, So you know, it's 456 00:28:05,240 --> 00:28:09,040 Speaker 1: it's an important distinction to make. Anyway, that was a 457 00:28:09,080 --> 00:28:11,840 Speaker 1: bit of a tangent to say that linear programming works 458 00:28:11,960 --> 00:28:15,680 Speaker 1: if the relationships between all the variables is in fact linear. 459 00:28:16,160 --> 00:28:19,560 Speaker 1: But if if it's not, If the relationship, say is 460 00:28:19,640 --> 00:28:24,639 Speaker 1: exponential or logarithmic or anything like that, linear programming doesn't apply. 461 00:28:25,280 --> 00:28:28,600 Speaker 1: And the real world is pretty darn complicated. So linear 462 00:28:28,640 --> 00:28:31,960 Speaker 1: programming relies on sort of kind of dumbing down what's 463 00:28:32,000 --> 00:28:34,760 Speaker 1: really going on in the real world. Two. Again, more 464 00:28:34,800 --> 00:28:37,840 Speaker 1: of an approximation, and the solution that you arrive at 465 00:28:37,960 --> 00:28:40,760 Speaker 1: might not be the ideal solution, but it might be 466 00:28:40,920 --> 00:28:43,479 Speaker 1: good enough, depending upon what it is you're trying to do. 467 00:28:44,200 --> 00:28:47,680 Speaker 1: Another limitation of linear programming is that as you add 468 00:28:47,720 --> 00:28:51,000 Speaker 1: more variables to a problem, This is specific to the 469 00:28:51,040 --> 00:28:54,920 Speaker 1: simplex method. As you add more variables, well, it grows 470 00:28:54,960 --> 00:28:59,000 Speaker 1: more difficult to lay out in a linear fashion. You're 471 00:28:59,040 --> 00:29:04,280 Speaker 1: you're adding more uncertainty, and the methodology has trouble dealing 472 00:29:04,320 --> 00:29:09,560 Speaker 1: with additional uncertainty. Perhaps ironically, the complexity of the linear 473 00:29:09,640 --> 00:29:14,160 Speaker 1: function would grow exponentially as more variables joined a problem. 474 00:29:14,200 --> 00:29:18,440 Speaker 1: So this process would be unsuitable for certain subsets of 475 00:29:18,520 --> 00:29:21,719 Speaker 1: computational problems because they just would get so complex that 476 00:29:21,760 --> 00:29:24,160 Speaker 1: even the most advanced computers in the world wouldn't be 477 00:29:24,160 --> 00:29:28,320 Speaker 1: able to handle them. Later on, other mathematicians would propose 478 00:29:28,400 --> 00:29:32,320 Speaker 1: algorithms that could compensate for this particular limitation of the 479 00:29:32,360 --> 00:29:37,680 Speaker 1: simplex method. For example, there are polynomial time algorithms. We're 480 00:29:37,680 --> 00:29:41,040 Speaker 1: gonna leave that for the time being, because ain't no 481 00:29:41,120 --> 00:29:44,440 Speaker 1: way I'm going to get that right anyway. I wanted 482 00:29:44,440 --> 00:29:48,400 Speaker 1: to talk about those two algorithms, in particular, the Metropolis 483 00:29:48,440 --> 00:29:52,200 Speaker 1: algorithm and the simplex method, because they are the foundation 484 00:29:52,320 --> 00:29:55,080 Speaker 1: for a lot of work that's been done in computer science. 485 00:29:55,120 --> 00:29:59,479 Speaker 1: But let's get some really basic ideas in with the 486 00:29:59,520 --> 00:30:04,080 Speaker 1: next one. Let's talk about sorting. Sorting is all about 487 00:30:04,160 --> 00:30:07,600 Speaker 1: arranging a list of things in order with regard to 488 00:30:07,680 --> 00:30:13,520 Speaker 1: some specific feature of those things. That seems pretty basic, right, 489 00:30:13,560 --> 00:30:16,320 Speaker 1: I Mean, there's a real world example that I think 490 00:30:16,360 --> 00:30:18,280 Speaker 1: most of us have had in the past, which is 491 00:30:18,320 --> 00:30:21,640 Speaker 1: that let's say you're looking at an online store and 492 00:30:21,680 --> 00:30:26,720 Speaker 1: you're searching for a specific product or specific type of product. 493 00:30:26,800 --> 00:30:29,320 Speaker 1: Let's say it's a blender, because I had to do 494 00:30:29,400 --> 00:30:32,880 Speaker 1: this recently, right, So you go to some online store 495 00:30:32,920 --> 00:30:35,840 Speaker 1: and you're searching for blenders and you get results, Well, 496 00:30:35,880 --> 00:30:38,040 Speaker 1: you might actually want to sort those results by a 497 00:30:38,080 --> 00:30:40,240 Speaker 1: specific way. Maybe you want to sort it by price, 498 00:30:40,360 --> 00:30:42,400 Speaker 1: and you want to go low to high because you 499 00:30:42,440 --> 00:30:44,479 Speaker 1: have a specific budget, so you just want to look at, 500 00:30:45,000 --> 00:30:47,600 Speaker 1: you know, blenders that are an x price or less. 501 00:30:48,440 --> 00:30:51,160 Speaker 1: Maybe you want to sort it by high price too 502 00:30:51,200 --> 00:30:53,760 Speaker 1: low because maybe you're a fat cat tycoon type and 503 00:30:53,760 --> 00:30:55,840 Speaker 1: you're just thinking, I want whatever is the most expensive. 504 00:30:56,600 --> 00:30:59,360 Speaker 1: Or maybe you want to sort the results by customer 505 00:30:59,440 --> 00:31:03,520 Speaker 1: review because we know rice and quality don't always go 506 00:31:03,640 --> 00:31:06,400 Speaker 1: hand in hand. Maybe you just want to look at 507 00:31:06,440 --> 00:31:08,920 Speaker 1: all the blenders in alphabetical order, or maybe you want 508 00:31:08,920 --> 00:31:11,920 Speaker 1: to look at them in a reverse alphabetical order. You 509 00:31:12,000 --> 00:31:15,720 Speaker 1: do you. Sorting is one of those most basic functions 510 00:31:16,160 --> 00:31:19,880 Speaker 1: and heavily studied concepts within computer science, so much so 511 00:31:20,040 --> 00:31:25,640 Speaker 1: that a lot of programming language libraries have sorting functions 512 00:31:25,640 --> 00:31:29,240 Speaker 1: built into them. But it's still one of those things 513 00:31:29,240 --> 00:31:31,640 Speaker 1: that people look at to see if there are better 514 00:31:31,680 --> 00:31:36,240 Speaker 1: ways to sort various types of data, particularly as you 515 00:31:36,280 --> 00:31:42,200 Speaker 1: get into a larger number of of sortable features um 516 00:31:42,240 --> 00:31:45,440 Speaker 1: and it becomes really important. So let's take Google's search 517 00:31:45,480 --> 00:31:49,680 Speaker 1: algorithm for example. Now, that name suggests that the algorithm 518 00:31:49,720 --> 00:31:52,600 Speaker 1: we're talking about is related to the process of searching 519 00:31:52,640 --> 00:31:55,720 Speaker 1: the web for pages that relate to a given search query, 520 00:31:55,960 --> 00:31:58,600 Speaker 1: and in fact, Google does have a search algorithm that 521 00:31:58,680 --> 00:32:01,440 Speaker 1: does this. But most of the time I hear people 522 00:32:01,480 --> 00:32:05,760 Speaker 1: talking about the search algorithm, they actually mean that the 523 00:32:05,840 --> 00:32:10,280 Speaker 1: algorithm that Google relies upon to determine what the order 524 00:32:10,440 --> 00:32:13,280 Speaker 1: of search results are going to be that a person 525 00:32:13,320 --> 00:32:15,680 Speaker 1: sees when they search for, you know, whatever it might be. 526 00:32:16,600 --> 00:32:20,840 Speaker 1: This is critically important because multiple studies have shown that 527 00:32:20,880 --> 00:32:23,840 Speaker 1: most people never bother to go beyond the first page 528 00:32:23,880 --> 00:32:27,400 Speaker 1: of search results, which means that Google really needs to 529 00:32:27,400 --> 00:32:30,480 Speaker 1: do its best to make sure that the most relevant 530 00:32:30,600 --> 00:32:35,000 Speaker 1: results to any given search query show up toward the 531 00:32:35,040 --> 00:32:38,520 Speaker 1: top of this list, because most people are never going 532 00:32:38,560 --> 00:32:41,480 Speaker 1: to bother going any further than that. And if those 533 00:32:41,480 --> 00:32:44,560 Speaker 1: people decide that Google search results just aren't any good, 534 00:32:45,040 --> 00:32:48,200 Speaker 1: they could conceivably use some other search engine. And let 535 00:32:48,200 --> 00:32:53,440 Speaker 1: me tell you. Google hates that idea. So Google's goal 536 00:32:53,800 --> 00:32:56,960 Speaker 1: is to present to users search results that are most 537 00:32:57,040 --> 00:33:00,400 Speaker 1: likely going to meet whatever their needs are based on 538 00:33:00,560 --> 00:33:03,800 Speaker 1: their search criteria. And way back in the day, Google 539 00:33:04,160 --> 00:33:08,560 Speaker 1: relied pretty much solely on an algorithm called page rank, 540 00:33:09,760 --> 00:33:13,040 Speaker 1: and from what I understand, Google still relies on page rink, 541 00:33:13,080 --> 00:33:17,280 Speaker 1: but also makes use of several other algorithms to augment 542 00:33:17,720 --> 00:33:21,760 Speaker 1: page drink. But the page rank algorithm would take a 543 00:33:21,800 --> 00:33:25,800 Speaker 1: ton of stuff into account in the process of determining 544 00:33:26,440 --> 00:33:29,960 Speaker 1: where within a list of search results any given example 545 00:33:30,040 --> 00:33:35,400 Speaker 1: should appear. So let's say that I'm searching for blenders 546 00:33:35,440 --> 00:33:41,080 Speaker 1: on Google for some reason, and the search algorithm has 547 00:33:41,120 --> 00:33:43,959 Speaker 1: gone out and indexed a ton of web pages that 548 00:33:44,240 --> 00:33:47,920 Speaker 1: deal with blenders. Let's say that one of those results 549 00:33:48,640 --> 00:33:52,080 Speaker 1: is in a blog post that isn't that old, it's 550 00:33:52,120 --> 00:33:56,480 Speaker 1: fairly recent, but from a mostly unknown source, and very 551 00:33:56,520 --> 00:34:01,680 Speaker 1: few other documents are linking into this blog. Well, chances 552 00:34:01,720 --> 00:34:05,800 Speaker 1: are that search result would appear really far down on 553 00:34:05,840 --> 00:34:09,400 Speaker 1: the list, probably pages and pages and pages down on 554 00:34:09,440 --> 00:34:12,719 Speaker 1: the results. But then let's say that there's another web 555 00:34:12,760 --> 00:34:16,359 Speaker 1: page that belongs to an established entity, one that has 556 00:34:16,400 --> 00:34:19,319 Speaker 1: a good reputation that's been around for a while, and 557 00:34:19,360 --> 00:34:22,600 Speaker 1: there are a ton of other pages that link to 558 00:34:22,880 --> 00:34:27,120 Speaker 1: this particular website, well, that one would probably rank fairly 559 00:34:27,239 --> 00:34:31,920 Speaker 1: high on the list. So the page rank algorithm essentially 560 00:34:31,920 --> 00:34:36,040 Speaker 1: assigns a score to each search result, and the value 561 00:34:36,080 --> 00:34:39,040 Speaker 1: of that score depends upon lots of stuff I mentioned, 562 00:34:39,040 --> 00:34:42,240 Speaker 1: as well as tons of other variables, and these variables 563 00:34:42,239 --> 00:34:45,120 Speaker 1: can either boost a score higher or it can knock 564 00:34:45,239 --> 00:34:48,480 Speaker 1: some points off. And then page rank would take all 565 00:34:48,520 --> 00:34:52,760 Speaker 1: these different search results and order them based upon those scores. 566 00:34:53,120 --> 00:34:57,880 Speaker 1: Essentially really oversimplifying here, but the idea was that the 567 00:34:57,920 --> 00:35:02,239 Speaker 1: more reliable and therefore real event results would likely be 568 00:35:02,360 --> 00:35:06,000 Speaker 1: the ones that were the most popular, So all those 569 00:35:06,080 --> 00:35:08,600 Speaker 1: links that aimed at a page would count for a lot. 570 00:35:09,360 --> 00:35:13,320 Speaker 1: If you happen to run the definitive page on blenders 571 00:35:13,360 --> 00:35:17,160 Speaker 1: and everyone was linking to you, that would boost your 572 00:35:17,160 --> 00:35:21,800 Speaker 1: page links score significantly. Now, clearly, just because something is 573 00:35:21,840 --> 00:35:27,560 Speaker 1: popular doesn't necessarily mean it's the most relevant or valuable thing, 574 00:35:27,760 --> 00:35:33,839 Speaker 1: but it's generally more true than it isn't true. It 575 00:35:33,920 --> 00:35:37,320 Speaker 1: might not always be the absolute best result, but it 576 00:35:37,440 --> 00:35:40,880 Speaker 1: might be reliably relevant, and that was what was important 577 00:35:40,920 --> 00:35:44,360 Speaker 1: to Google and to Google's users. Again, it just needs 578 00:35:44,400 --> 00:35:48,279 Speaker 1: to be good enough. So the page rank algorithm was 579 00:35:48,400 --> 00:35:51,960 Speaker 1: using a pretty complex sorting method to determine which results 580 00:35:52,000 --> 00:35:55,840 Speaker 1: should be the most visible. You can, of course, page 581 00:35:55,880 --> 00:35:59,240 Speaker 1: through search results. You don't have to go with whichever 582 00:35:59,320 --> 00:36:03,319 Speaker 1: one's are on page one, And in theory, if you 583 00:36:03,480 --> 00:36:07,560 Speaker 1: keep on scrolling through, going to page after page after 584 00:36:07,600 --> 00:36:12,000 Speaker 1: page of search results, then over time you should see 585 00:36:12,040 --> 00:36:15,160 Speaker 1: that the results you're getting are not as relevant as 586 00:36:15,200 --> 00:36:18,520 Speaker 1: those that appeared earlier on the list, assuming everything is 587 00:36:18,520 --> 00:36:24,319 Speaker 1: working properly. Again, this doesn't always happen, but generally it's oh, 588 00:36:24,480 --> 00:36:28,839 Speaker 1: it holds true, and yeah, I'm drastically oversimplifying. You could 589 00:36:28,840 --> 00:36:33,080 Speaker 1: teach an entire computer science course on the page rink 590 00:36:33,120 --> 00:36:36,440 Speaker 1: algorithm and how it works. We're not going to do that. 591 00:36:36,560 --> 00:36:40,200 Speaker 1: I would just get it wrong anyway. Speaking of search, however, 592 00:36:40,480 --> 00:36:43,960 Speaker 1: let's talk about a much simpler form of search that's 593 00:36:44,000 --> 00:36:47,880 Speaker 1: based on a basic algorithm, and this is called binary search. 594 00:36:48,600 --> 00:36:51,120 Speaker 1: This is a process that's meant to decrease the amount 595 00:36:51,120 --> 00:36:54,280 Speaker 1: of time it takes to search for a specific value 596 00:36:54,880 --> 00:36:59,440 Speaker 1: within a sordid array of values. Alright, so let's say 597 00:36:59,440 --> 00:37:03,480 Speaker 1: that you've got a really big array or list of 598 00:37:03,840 --> 00:37:08,359 Speaker 1: entries right, and it's massive, and you're searching for a 599 00:37:08,440 --> 00:37:13,520 Speaker 1: specific target that has a specific value associated with it, 600 00:37:14,200 --> 00:37:19,160 Speaker 1: and a computer could go through this list item by item, 601 00:37:19,160 --> 00:37:22,399 Speaker 1: comparing it with your target right and look to see 602 00:37:22,440 --> 00:37:24,440 Speaker 1: if there's a match. If there's not a match, you 603 00:37:24,440 --> 00:37:26,480 Speaker 1: can go to the next item on the list and 604 00:37:26,560 --> 00:37:30,120 Speaker 1: do that. But if you're talking about a truly huge list, 605 00:37:30,320 --> 00:37:33,120 Speaker 1: this could take ages because if it happens to be 606 00:37:33,160 --> 00:37:34,680 Speaker 1: at the bottom of that list, you have to wait 607 00:37:34,719 --> 00:37:38,280 Speaker 1: for the computer to go through every single other entry 608 00:37:38,360 --> 00:37:43,000 Speaker 1: before it gets there. So a binary search cuts this short. 609 00:37:44,000 --> 00:37:48,360 Speaker 1: It takes a value that's in the middle of the array, 610 00:37:48,520 --> 00:37:52,280 Speaker 1: so like halfway down the list. Essentially it just pulls 611 00:37:52,360 --> 00:37:55,480 Speaker 1: that value and it compares it against your target, the 612 00:37:55,480 --> 00:37:58,759 Speaker 1: thing that you're searching for. And if the array is 613 00:37:58,800 --> 00:38:01,879 Speaker 1: a hundred thousand trees long, it's essentially looking at entry 614 00:38:01,960 --> 00:38:06,160 Speaker 1: number fifty thousand and one. It compares this to your search. 615 00:38:06,560 --> 00:38:09,839 Speaker 1: And let's say the value target of your of your 616 00:38:09,880 --> 00:38:14,600 Speaker 1: search query is lower than the entry that appeared at 617 00:38:14,640 --> 00:38:18,359 Speaker 1: fifty thousand and one. Well, now the binary search just 618 00:38:18,440 --> 00:38:22,560 Speaker 1: tosses everything that's fifty and one or higher on the 619 00:38:22,640 --> 00:38:25,040 Speaker 1: list because the values are only going to go up 620 00:38:25,080 --> 00:38:28,240 Speaker 1: from there, so it can get rid of half the list. 621 00:38:28,840 --> 00:38:33,120 Speaker 1: Right there, You're left with fifty thousand items in this array, 622 00:38:33,200 --> 00:38:37,000 Speaker 1: and the algorithm repeats this process. It goes for an 623 00:38:37,160 --> 00:38:40,320 Speaker 1: entry smack dab in the middle of the array, compares 624 00:38:40,360 --> 00:38:43,600 Speaker 1: it to the target. If the target's value is lower 625 00:38:44,200 --> 00:38:49,960 Speaker 1: than the middle entry of this array, then you you 626 00:38:50,040 --> 00:38:53,960 Speaker 1: dump everything that's at a higher number than that if 627 00:38:54,000 --> 00:38:57,040 Speaker 1: it's lower or its higher. Rather, if the target value 628 00:38:57,040 --> 00:38:59,279 Speaker 1: is higher than the middle entry, then you would get 629 00:38:59,360 --> 00:39:01,840 Speaker 1: rid of all the previous ones, like one through twenty 630 00:39:01,880 --> 00:39:05,000 Speaker 1: five thousand. For example, Let's say that you know your 631 00:39:05,040 --> 00:39:07,840 Speaker 1: your target value is higher than the middle entry of 632 00:39:07,880 --> 00:39:11,480 Speaker 1: twenty and one. It's gonna dump everything from one to 633 00:39:12,040 --> 00:39:15,040 Speaker 1: thousand and start over again and half it again again. 634 00:39:15,080 --> 00:39:17,960 Speaker 1: I'm kind of oversimplifying here, but the idea of binary 635 00:39:18,000 --> 00:39:21,080 Speaker 1: search is that rather than go through every single entry, 636 00:39:21,200 --> 00:39:25,360 Speaker 1: it keeps cutting this array in half, comparing it with 637 00:39:25,440 --> 00:39:29,080 Speaker 1: the target, and doing it again, which reduces the number 638 00:39:29,120 --> 00:39:33,200 Speaker 1: of times it takes to find the specific answer. Uh. 639 00:39:33,360 --> 00:39:35,640 Speaker 1: You might have thought of the like the the experiment 640 00:39:35,680 --> 00:39:39,680 Speaker 1: where you think about you're given two pennies on day 641 00:39:39,680 --> 00:39:42,440 Speaker 1: one and the next day, you're given four pennies or 642 00:39:42,480 --> 00:39:45,120 Speaker 1: cents if you prefer two cents. The next day you 643 00:39:45,120 --> 00:39:47,280 Speaker 1: get four cents. The next day you get eight cents, 644 00:39:47,320 --> 00:39:50,680 Speaker 1: and it doubles, and pretty quickly you see how that 645 00:39:50,800 --> 00:39:53,440 Speaker 1: doubling can actually start to amount to what we would consider, 646 00:39:53,600 --> 00:39:56,359 Speaker 1: you know, like quote unquote real money, same sort of thing. 647 00:39:56,400 --> 00:40:00,319 Speaker 1: By by having an array over and over again, you 648 00:40:00,520 --> 00:40:03,279 Speaker 1: very quickly whittle down the stuff you have to go 649 00:40:03,360 --> 00:40:05,759 Speaker 1: through and it speeds up the process of searching for 650 00:40:05,800 --> 00:40:11,720 Speaker 1: a specific value within a huge UH data list. Binary 651 00:40:11,760 --> 00:40:14,680 Speaker 1: search is just one form of search for for various 652 00:40:14,760 --> 00:40:18,600 Speaker 1: data constructs. There are lots of others. For example, there's 653 00:40:18,680 --> 00:40:23,200 Speaker 1: depth first search and breadth first search. I won't get 654 00:40:23,239 --> 00:40:25,960 Speaker 1: too deep into this but because it gets really technical, 655 00:40:26,040 --> 00:40:28,640 Speaker 1: but I can describe what's what's happening here from a 656 00:40:28,719 --> 00:40:32,800 Speaker 1: high level. So these search functions are used for data 657 00:40:32,840 --> 00:40:37,200 Speaker 1: structures that are that consists of nodes. And this is 658 00:40:37,239 --> 00:40:40,520 Speaker 1: easier to understand if we use an analogy, and I 659 00:40:40,560 --> 00:40:43,000 Speaker 1: want you to think of a choose your own adventure 660 00:40:43,160 --> 00:40:46,440 Speaker 1: book in case you're not familiar with those. These are 661 00:40:46,480 --> 00:40:49,120 Speaker 1: books where you would read a page and at the 662 00:40:49,200 --> 00:40:51,520 Speaker 1: end of the page, you would actually be given a choice, 663 00:40:51,600 --> 00:40:55,160 Speaker 1: like you could choose what the character you're reading about 664 00:40:55,160 --> 00:40:58,120 Speaker 1: would do next. So you might get to the end 665 00:40:58,160 --> 00:41:00,880 Speaker 1: of the first page of like a mystery book, and 666 00:41:01,360 --> 00:41:05,400 Speaker 1: the instruction might say, if you want your protagonists to 667 00:41:05,440 --> 00:41:08,279 Speaker 1: go down the hall, turn to page eight. If you 668 00:41:08,320 --> 00:41:11,359 Speaker 1: want her to shut a door and walk away, turn 669 00:41:11,440 --> 00:41:13,920 Speaker 1: to page twenty three, and you would make your choice, 670 00:41:13,960 --> 00:41:16,239 Speaker 1: turn to that page and continue the story that way. 671 00:41:16,320 --> 00:41:21,200 Speaker 1: And so the story branches, and you've got these branching pathways. Well. 672 00:41:21,239 --> 00:41:26,880 Speaker 1: Depth first and breadth first searches explore nodes in different ways. 673 00:41:27,000 --> 00:41:31,960 Speaker 1: A depth first search follows each branched path all the 674 00:41:32,000 --> 00:41:35,120 Speaker 1: way down from start to the end of that one branch, 675 00:41:35,719 --> 00:41:39,359 Speaker 1: before moving on to look at a different branch. So 676 00:41:39,400 --> 00:41:41,880 Speaker 1: in our example, would the Choose your Own Adventure book, 677 00:41:42,160 --> 00:41:45,239 Speaker 1: a depth first search would go to page eight to 678 00:41:45,400 --> 00:41:50,440 Speaker 1: follow your protagonists down the hall. Then whatever the options 679 00:41:50,440 --> 00:41:52,040 Speaker 1: were at the end of that, it would go with 680 00:41:52,080 --> 00:41:55,440 Speaker 1: the first option, continue and doing this all the time 681 00:41:55,760 --> 00:41:58,239 Speaker 1: until you get to the end of that pathway. Then 682 00:41:58,280 --> 00:42:01,040 Speaker 1: it would come back up to the next most recent branch, 683 00:42:01,160 --> 00:42:02,919 Speaker 1: follow that all the way to the end, and so 684 00:42:03,000 --> 00:42:07,279 Speaker 1: on until it had searched through every possible pathway in 685 00:42:07,360 --> 00:42:10,920 Speaker 1: this this uh this graph, that's what we would call it. 686 00:42:12,000 --> 00:42:17,920 Speaker 1: Breath search instead progresses equally across all possible paths. So 687 00:42:18,040 --> 00:42:21,920 Speaker 1: breath search would mean that you would go to page eight, 688 00:42:22,840 --> 00:42:24,759 Speaker 1: and let's say at the end of page eight, it 689 00:42:24,800 --> 00:42:27,560 Speaker 1: says you can then turn to page seventeen or page 690 00:42:27,560 --> 00:42:29,719 Speaker 1: fifty two to make your next choice. But instead of 691 00:42:29,760 --> 00:42:32,920 Speaker 1: continuing down that pathway, you back up to your starting 692 00:42:32,920 --> 00:42:35,720 Speaker 1: position and then you go down to page twenty three. 693 00:42:35,760 --> 00:42:37,520 Speaker 1: You know, the other option where you would close the 694 00:42:37,520 --> 00:42:40,120 Speaker 1: door and walk away. You would read that maybe at 695 00:42:40,120 --> 00:42:42,400 Speaker 1: the end of that page it says you can choose 696 00:42:42,400 --> 00:42:45,600 Speaker 1: to either go to page three or to page forty six. Well, 697 00:42:45,800 --> 00:42:48,160 Speaker 1: then you would go back to your your first branch. 698 00:42:48,200 --> 00:42:52,640 Speaker 1: You would go down the list of pages seventeen and 699 00:42:52,719 --> 00:42:55,960 Speaker 1: fifty two and three and forty six, maybe those all 700 00:42:56,040 --> 00:42:59,040 Speaker 1: end in different choices. You would then do all of 701 00:42:59,040 --> 00:43:01,680 Speaker 1: those across the board. Next you're you're searching across the 702 00:43:01,760 --> 00:43:06,200 Speaker 1: width of the graph the breadth of it. Both are 703 00:43:06,320 --> 00:43:09,760 Speaker 1: valid forms of searching, and the method used typically depends 704 00:43:09,840 --> 00:43:12,239 Speaker 1: upon the type of data being searched and what you're 705 00:43:12,239 --> 00:43:15,040 Speaker 1: trying to do. We've got a lot more to cover 706 00:43:15,080 --> 00:43:19,000 Speaker 1: with algorithms, but I feel like I'm gonna have to 707 00:43:19,080 --> 00:43:23,080 Speaker 1: give you guys a break, So let's do that really quick, 708 00:43:23,160 --> 00:43:26,680 Speaker 1: and I'll just give you a very short example following, 709 00:43:27,200 --> 00:43:29,760 Speaker 1: and then we'll pick up back up with algorithms again 710 00:43:29,840 --> 00:43:32,400 Speaker 1: in a future episode. But first let's take this quick break, 711 00:43:33,040 --> 00:43:43,279 Speaker 1: all right. I know I've waxed poetic about algorithms so 712 00:43:43,360 --> 00:43:46,399 Speaker 1: much so that this episode is running longer than I anticipated. 713 00:43:46,440 --> 00:43:52,640 Speaker 1: I have a whole extra section to talk about with algorithms, 714 00:43:52,640 --> 00:43:56,040 Speaker 1: including things that are related to algorithms but aren't necessarily 715 00:43:56,160 --> 00:44:00,520 Speaker 1: specifically algorithms, stuff like hashing and Markov models and things 716 00:44:00,560 --> 00:44:03,600 Speaker 1: of that nature. But I want to finish up with 717 00:44:03,680 --> 00:44:06,239 Speaker 1: one that I think is kind of fun. And this 718 00:44:06,320 --> 00:44:09,479 Speaker 1: is called the Doomsday rule. And to be be fair, 719 00:44:09,560 --> 00:44:12,200 Speaker 1: this is not just a computational algorithm. This is something 720 00:44:12,239 --> 00:44:14,440 Speaker 1: that you can do in your head if you learn 721 00:44:14,560 --> 00:44:16,960 Speaker 1: the rule. I'm not saying I could do it. I 722 00:44:16,960 --> 00:44:21,319 Speaker 1: haven't really committed this to a memory process yet, but 723 00:44:21,400 --> 00:44:26,000 Speaker 1: it is possible. And the Doomsday rule sounds pretty ominous, however, right. 724 00:44:26,120 --> 00:44:29,400 Speaker 1: I mean, it's basically to figure out what day of 725 00:44:29,440 --> 00:44:33,839 Speaker 1: the week any given date is So if you were 726 00:44:33,880 --> 00:44:36,880 Speaker 1: an expert with the doomsday rule and I asked you, hey, 727 00:44:37,080 --> 00:44:41,279 Speaker 1: what day of the week does June five fall on? 728 00:44:41,920 --> 00:44:44,160 Speaker 1: You could use that rule and say, oh, that's gonna 729 00:44:44,160 --> 00:44:46,920 Speaker 1: be a Thursday. That also, by the way, happens to 730 00:44:46,920 --> 00:44:50,399 Speaker 1: be the day I'll turn fifty. Yikes, man, we're coming 731 00:44:50,440 --> 00:44:53,400 Speaker 1: up on that one. All right, So where did this 732 00:44:53,560 --> 00:44:56,520 Speaker 1: rule come from? And what the heck is this doomsday 733 00:44:56,520 --> 00:44:59,080 Speaker 1: stuff about? Well, the doomsday thing is kind of just 734 00:44:59,120 --> 00:45:02,520 Speaker 1: a cheeky name, and there's all these different ways we 735 00:45:02,520 --> 00:45:06,920 Speaker 1: could describe that. But during any given year, there are 736 00:45:07,000 --> 00:45:09,879 Speaker 1: certain dates that will always share the same day of 737 00:45:09,920 --> 00:45:12,160 Speaker 1: the week, which is no big surprise, right. I mean, 738 00:45:12,719 --> 00:45:17,120 Speaker 1: you might notice that Christmas, that is December, falls on 739 00:45:17,160 --> 00:45:19,680 Speaker 1: the same day of the week as New Year's Day 740 00:45:19,880 --> 00:45:22,439 Speaker 1: for the following year that happened, you know, January one. 741 00:45:22,480 --> 00:45:26,040 Speaker 1: It always is that way. But with the doomsday rule, 742 00:45:26,600 --> 00:45:31,120 Speaker 1: the dates for that are called doomsdays. Are things like 743 00:45:31,239 --> 00:45:36,040 Speaker 1: April four or four four, June six that's six six, 744 00:45:36,520 --> 00:45:40,160 Speaker 1: August eight that's eight eight, and you know, so on 745 00:45:40,200 --> 00:45:46,000 Speaker 1: like October tenth, that's ten ten. The anchor day are 746 00:45:46,080 --> 00:45:51,200 Speaker 1: called these are anchor days. They're called doomsdays, um they 747 00:45:51,280 --> 00:45:55,200 Speaker 1: change with each year or with leap years. The anchor 748 00:45:55,280 --> 00:45:58,759 Speaker 1: day actually leaps a year, but once you know that day, 749 00:45:58,920 --> 00:46:01,120 Speaker 1: you know it's the same for all of those dates. 750 00:46:01,440 --> 00:46:07,120 Speaker 1: So for one, as I record this, this year's doomsday 751 00:46:07,440 --> 00:46:10,160 Speaker 1: is or anchor day is a Sunday. So that means 752 00:46:10,200 --> 00:46:12,520 Speaker 1: every Doomsday is going to be a Sunday. So I'm 753 00:46:12,520 --> 00:46:17,600 Speaker 1: recording this in July with our next doomsday being on 754 00:46:17,760 --> 00:46:23,640 Speaker 1: August eight, so that means August eight should be a Sunday. 755 00:46:23,680 --> 00:46:26,399 Speaker 1: And if you look at the calendar, you'll see that yes, 756 00:46:26,560 --> 00:46:30,160 Speaker 1: August day is a Sunday. That means that October ten 757 00:46:30,560 --> 00:46:35,200 Speaker 1: should be a Sunday, that December twelve should be a Sunday. 758 00:46:35,280 --> 00:46:37,600 Speaker 1: So the doomsday rule involves a little bit more than 759 00:46:37,680 --> 00:46:40,960 Speaker 1: just this, but not much more. And this means that 760 00:46:41,120 --> 00:46:44,319 Speaker 1: if you learn the doomsday rule and you have a 761 00:46:44,360 --> 00:46:48,560 Speaker 1: general idea of what the anchor day is for each year, 762 00:46:49,120 --> 00:46:52,319 Speaker 1: you can calculate what in what day of the week 763 00:46:52,560 --> 00:46:57,239 Speaker 1: any given date will fall on, including past years. The 764 00:46:57,239 --> 00:47:00,000 Speaker 1: guy who came up with this was a mathematician named 765 00:47:00,239 --> 00:47:04,360 Speaker 1: John Conway, and reportedly he could give you an answer 766 00:47:04,440 --> 00:47:06,560 Speaker 1: in less than two seconds if you gave him a date, 767 00:47:06,600 --> 00:47:08,080 Speaker 1: he could tell you what day of the week it 768 00:47:08,120 --> 00:47:11,760 Speaker 1: was going to fall on in two seconds or less. Sadly, 769 00:47:11,840 --> 00:47:15,239 Speaker 1: he passed away last year at the age of eighty 770 00:47:15,280 --> 00:47:20,000 Speaker 1: two after he contracted COVID nineteen. But that doomsday rule 771 00:47:20,080 --> 00:47:21,799 Speaker 1: is one that I think is super cool. I've seen 772 00:47:21,840 --> 00:47:23,600 Speaker 1: people who can do this where you give them a 773 00:47:23,680 --> 00:47:25,719 Speaker 1: date and they're just able to tell you what day 774 00:47:25,719 --> 00:47:28,120 Speaker 1: of the week that falls on, and you can go 775 00:47:28,160 --> 00:47:30,520 Speaker 1: and check it and sure enough they're right. Well, this 776 00:47:30,600 --> 00:47:33,239 Speaker 1: is one process where you can do that. It's not 777 00:47:33,280 --> 00:47:35,960 Speaker 1: the only one, by the way, there are other algorithms 778 00:47:36,040 --> 00:47:39,360 Speaker 1: that also can help you determine what day of the 779 00:47:39,400 --> 00:47:42,680 Speaker 1: week a specific date will fall on. But the doomsday 780 00:47:42,760 --> 00:47:46,000 Speaker 1: rule is is one that works. And again I don't 781 00:47:46,040 --> 00:47:49,040 Speaker 1: have it, um. I don't have an expertise in this. 782 00:47:49,200 --> 00:47:51,759 Speaker 1: I haven't practiced it at all, so I can't do it. 783 00:47:52,239 --> 00:47:53,840 Speaker 1: If you came up to me and say, hey, Jonathan 784 00:47:54,400 --> 00:47:57,640 Speaker 1: May first, nineteen, what day of the week was that, 785 00:47:57,680 --> 00:48:01,279 Speaker 1: I'd be like, I don't know. Probably really a it's 786 00:48:01,320 --> 00:48:04,840 Speaker 1: probably a fine day. I don't I don't know because 787 00:48:04,840 --> 00:48:07,240 Speaker 1: I haven't done this yet. But I think it's really cool. 788 00:48:07,280 --> 00:48:10,960 Speaker 1: I gets. It illustrates how for certain types of problems 789 00:48:11,360 --> 00:48:14,560 Speaker 1: you can come up with a mathematical approach to solving 790 00:48:14,560 --> 00:48:18,600 Speaker 1: those problems, and it just is applicable for all problems 791 00:48:18,640 --> 00:48:21,880 Speaker 1: that fall into that category. And that's really the elegant 792 00:48:21,920 --> 00:48:24,439 Speaker 1: and cool thing about algorithms. Also the other cool things 793 00:48:24,520 --> 00:48:26,960 Speaker 1: that people are coming up with new ones all the time, 794 00:48:27,719 --> 00:48:31,120 Speaker 1: and they might be trying to refine earlier algorithms to 795 00:48:31,200 --> 00:48:34,400 Speaker 1: make them even more efficient and effective, or they might 796 00:48:34,400 --> 00:48:36,279 Speaker 1: be trying to come up with all new algorithms to 797 00:48:36,320 --> 00:48:41,320 Speaker 1: take advantage of emerging technology stuff like quantum computing. I 798 00:48:41,400 --> 00:48:44,560 Speaker 1: hope you enjoyed that episode. Like I said, it originally 799 00:48:44,560 --> 00:48:48,080 Speaker 1: published last year in two thousand twenty one, and hopefully 800 00:48:48,160 --> 00:48:51,239 Speaker 1: tomorrow I'll be back in shape and I'll be able 801 00:48:51,280 --> 00:48:54,920 Speaker 1: to do another news episode. We'll have to wait and see. 802 00:48:55,040 --> 00:48:56,799 Speaker 1: Like I said, I'm really hoping that this is just 803 00:48:57,400 --> 00:49:00,120 Speaker 1: a stomach bug thing that I'm dealing with and not 804 00:49:00,400 --> 00:49:04,120 Speaker 1: like round two of COVID. I do have a test 805 00:49:04,280 --> 00:49:06,480 Speaker 1: that literally I think just arrived at my door, so 806 00:49:06,560 --> 00:49:08,879 Speaker 1: I will check and make sure, because obviously I want 807 00:49:08,880 --> 00:49:11,200 Speaker 1: to be responsible and safe for all of my fellow 808 00:49:11,280 --> 00:49:13,920 Speaker 1: human beings. Out there. I hope all of you are 809 00:49:13,920 --> 00:49:17,080 Speaker 1: well and staying safe and healthy, and that you're having 810 00:49:17,360 --> 00:49:20,839 Speaker 1: a great summer so far. Uh you know, I plan 811 00:49:20,880 --> 00:49:24,040 Speaker 1: on having a great summer once I feel better. For now, 812 00:49:24,120 --> 00:49:27,719 Speaker 1: I'm just having a kind of grouchy summer because that's 813 00:49:27,920 --> 00:49:29,839 Speaker 1: I mean, that's my go to mood for pretty much 814 00:49:29,920 --> 00:49:33,680 Speaker 1: any situation, but particularly when I'm not feeling well. Anyway, 815 00:49:34,239 --> 00:49:37,680 Speaker 1: take care and I will talk to you again really soon. 816 00:49:43,560 --> 00:49:46,600 Speaker 1: Text Stuff is an I Heart Radio production. For more 817 00:49:46,680 --> 00:49:50,040 Speaker 1: podcasts from my Heart Radio, visit the i Heart Radio app, 818 00:49:50,200 --> 00:49:53,320 Speaker 1: Apple Podcasts, or wherever you listen to your favorite shows.