# Python for Absolute Beginners Transcripts Chapter: The big ideas of software development Lecture: Formal algorithms

0:00 We could have easily come up with this algorithm on our own but it turns out that many of these techniques appear over and over
0:08 and they get applied to all sorts of different problems and these I will call formal algorithms. For example, the thing that we just did
0:17 is a Binary Search algorithm where you start with somewhere and then you start breaking it into halves and say, Can we exclude half of the data?
0:26 Yes, or can we, make sure we only focus on half of the data and start partitioning down. And you can go learn all sorts of things about this
0:34 given some amount of data in an unoptimistic case we'd have to make as many guesses as possible or until there is no other sort of path
0:43 that doesn't allow for another guess. It would be this complexity called O(log n) which means as you add more data
0:49 10 versus a hundred versus a thousand the time it takes to find the answer is the log of 10 or a hundred or a thousand
0:56 as a ratio not exactly as a number. And the best part is maybe you just guess the number straight up
1:01 and that's just, doesn't matter how much data there is if you guessed right. The point is not to look at this complexity and stuff
1:07 but once you identify one of these formal algorithms all of a sudden you can see all the stuff that people have studied about it
1:14 you can see, oh, it actually applies in this other case. I first thought it was just about guessing the number of M&amp;M's in that jar
1:21 but it turns out it also helps me optimize this pathfinding algorithm or pathfinding program that I am trying to write.
1:28 I don't even know if that's actually true but once you know the algorithm you then know that it can be applied to all these different things.
1:35 So we're not going to go deep into a bunch of algorithms because this is not a Computer Science course but that's the idea.
1:40 You're going to run into these things you're like, Oh, I thought I just made this up. But no, it's actually this sort of formal thing that was studied
1:46 or somebody might tell you Oh, it's this kind of algorithm. And then you can go and look it up see how to do it in Python
1:52 usually there is a resource for that. To these algorithms sometimes it's just thinking about how my users are logging into my site
2:00 other times they're much more formalized like this search algorithm here.

Talk Python's Mastodon Michael Kennedy's Mastodon