Start a free Courses trial
to watch this video
In this video we develop a formal definition for an algorithm in the context of computer science.
In this course we are going to use the Python programming language to explore algorithms in code. If you're interested in learning Python, check out the Beginning Python Track that will teach you the basics of programming in Python.
If you would rather learn how to program in a different language, feel free to email me at pasan@teamtreehouse.com and I will point you in the right direction.
Glossary
- Algorithm - a set of steps or instructions for completing a task
- Algorithmic Thinking - analyzing a problem and breaking it down into distinct steps that can be solved separately
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up[MUSIC] 0:00 Hi, my name is Pasan. 0:09 I'm an instructor here at Treehouse and welcome to introduction to algorithms. 0:10 Whether you're a high school or college student, a developer in the industry, or 0:14 someone who is learning to code, you have undoubtedly running to the term algorithm. 0:19 For many people, this word is kind of scary. 0:24 It represents this body of knowledge that seems just out of reach. 0:27 Only people with computer science degrees know about algorithms. 0:31 Now to others, this brings up feelings of impostor syndrome. 0:34 You might already know how to code but 0:38 you're not a real developer because you don't know anything about algorithms. 0:40 Personally, it made me frame certain jobs as above my skill level, 0:45 because the interview contained algorithm questions. 0:49 Well, whatever your reasons are, in this course, our goal is to dispel 0:53 all those feelings and get you comfortable with the basics of algorithms. 0:57 Like any other subject, 1:02 I like to start my courses with what the course is and is not. 1:04 In this course, we're going to cover the very basic set of knowledge that you need 1:08 as a foundation for learning about algorithms. 1:13 This course is less about specific algorithms and 1:15 more about the tools you will need to evaluate algorithms, 1:19 understand how they perform, compare them to each other, and 1:22 make a statement about the utility of an algorithm in a given context. 1:26 Now don't worry, none of this will be theoretical and 1:30 we will learn these concepts by using well-known algorithms. 1:33 In this course, we'll also be writing code. 1:37 So I do expect you to have some programming experience if 1:40 you intend to continue with this topic. 1:42 You can definitely stick around even if you don't know how to code but 1:45 you might want to learn the basics of programming in the meantime. 1:48 In this course, we will be using the Python programming language. 1:52 Python reads a lot like regular English and is the language you will most likely 1:56 encounter when learning about algorithms these days. 2:01 If you don't know how to code or if you know how to code in a different language, 2:04 check out the note section of this video for 2:09 links to other content that might be useful to you. 2:11 As long as you understand the fundamentals of programming, 2:15 you should be able to follow along pretty well. 2:18 If you're a JavaScript developer or a student who's learning JavaScript, 2:21 for example, 2:25 chances are good that you'll still be able to understand the code we write later. 2:26 I'll be sure to provide links along the way if you need anything to follow up on. 2:30 Let's start with something simple. 2:35 What is an algorithm? 2:37 An algorithm is a set of steps or instructions for completing a task. 2:39 This might sound like an oversimplification but 2:43 really that's precisely what an algorithm is. 2:47 A recipe is an algorithm, your morning routine when you wake up is an algorithm, 2:50 and the driving directions you follow to get to a destination is also an algorithm. 2:55 In computer science, the term algorithm more specifically means the set of 3:00 steps a program takes to finish a task. 3:05 If you've written code before, any code really, generally speaking, 3:08 you have written an algorithm. 3:12 Given that much of the code we write can be considered an algorithm, 3:14 what do people mean when they say, you should know about algorithms? 3:18 Now, consider this. 3:22 Let's say, I'm a teacher in a classroom and 3:24 I tell everyone I have an assignment for them. 3:26 On their desks, they have a picture of a maze and 3:28 their task is to come up with a way to find the quickest way out of the maze. 3:31 Everyone does their thing and comes up with a solution. 3:36 Every single one of these solutions is a viable solution and 3:39 is a valid example of an algorithm. 3:42 The steps one needs to take to get out of the maze. 3:45 But from being in classrooms or any group of any sort, 3:48 you know that some people will have better ideas than others. 3:51 We all have a diverse array of skillsets. 3:55 Over time, our class picks the best of these solutions. 3:58 And anytime we want to solve a maze, we go with one of these solutions. 4:01 This is what the field of algorithms is about. 4:05 There are many problems in computer science but 4:08 some of them are pretty common, regardless of what project you're working on. 4:11 Different people have come up with different solutions to these 4:16 common problems. 4:19 And over time, the field of computer science has identified 4:20 several that do the job well for a given task. 4:24 When we talk of algorithms, we're referring to two points. 4:27 We're primarily saying there's an established body of knowledge on how to 4:31 solve particular problems well. 4:36 And it's important to know what these solutions are. 4:38 Now why is it important? 4:41 If you're unaware that a solution exists, 4:43 you might try to come up with one yourself. 4:45 And there's a likelihood that your solution won't be as good or efficient, 4:48 whatever that means, compared to those that have been thoroughly reviewed. 4:52 But there is a second component to it as well. 4:57 Part of understanding algorithms is not just knowing that an algorithm exists but 5:00 understanding when to apply it. 5:05 Understanding when to apply an algorithm requires properly 5:07 understanding the problem at hand. 5:11 And this, arguably, is the most important part of learning about algorithms and 5:13 data structures. 5:18 As you progress through this content, you should be able to look at a problem and 5:19 break it down into distinct steps. 5:24 When you have a set of steps, you should then be able identify which algorithm or 5:26 data structure is best for the task at hand. 5:31 This concept is called algorithmic thinking and it's something we're 5:33 going to try and cultivate together as we work through our content. 5:37 Lastly, learning about algorithms gives you a deeper understanding about 5:40 complexity and efficiency in programming. 5:45 Having a better sense of how your code will perform in different situations is 5:48 something that you'll always want to develop and hone. 5:53 Algorithmic thinking is why algorithms also come up in big tech interviews. 5:56 Interviewers don't care as much that you're able to write a specific algorithm 6:01 in code but more about the fact that you can break 6:06 a seemingly insurmountable problem into distinct components and 6:09 identify the right tools to solve each distinct component. 6:13 And that is what we plan on doing. 6:17 In this course, though, we're going to focus on some of the tools and concepts 6:19 you will need to be aware of before we can dive into the topic of algorithms. 6:24 If you're ready, let's get started. 6:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up