What Are Algorithms and Why They're Important
A free video tutorial from Tim Short
Dev / Train / Recuit
4.4 instructor rating • 4 courses • 143,625 students
Learn more from the full courseBecome a Junior Java Software Developer
Complete practical and conceptual Java programming course for beginners
07:45:34 of on-demand video • Updated August 2017
- Be comfortable with writing and designing Java applications
- Apply core concepts of object-oriented programming to a project
- Build holistic, real-world practical applications from the ground up
- Write common algorithms covered in computer science courses
- Talk confidently about Java programming and object-oriented programming
- Network with recruiters, hiring managers, and tech professionals
- Walk into your first job interview and code review with confidence
- Invitation to participate in internship through SDET University!
English [Auto] Hi, welcome back, and I want to talk about algorithms now, and this is actually something where a lot of Java courses actually fall short, though, teach some of the basics for object oriented programming. I'll read a couple applications. You'll learn about the collections framework and some data structures. But again, where we go the extra mile is we want to teach algorithms, what I say an introduction to computer science and talk about this just second. But again, we want to teach you things that will let you that will help you pass the interview, that will help you get the job. And so we will set you apart is your ability to work with algorithms and your ability to think critically and solve problems. And so this is much of what algorithms is asking. And our job is, is to help you get hired. So I want to talk about algorithms. We talk about thinking like a computer. Right. Or making your computer think like a human. Analyze this. Right. So how we think we're able to do things as humans. We're able to do things incredibly fast, intuitively because of our because of our intelligence, because of the way we've been intelligently designed. And and so we're able to make connections and come to conclusions very fast. Computers have high processing power, but we actually need to program them. We need to think we need to tell them how to think. We need to give them instructions. So we come to this term. The algorithms, algorithms are systematic approach to methodically and efficiently solve problems using repetition and calculation within complex data structures. This is my definition that helps us make through. So it's methodical and it's efficient. And I say it's the job of computer scientists to handle complex algorithms and data structures efficiently. So if you got a if you majored in computer science, you would spend a lot of time working with algorithms, learning the basic ones, enhancing them to be very, very complex. But this is where computer scientists make their money from haling algorithms. Of course, this course is not designed to create computer scientists, but we should be familiar with the process and we should be comfortable with the the ideas of certain algorithms as as developers. OK, so some common algorithms I'm going to cover. We'll see how much time I have to cover throughout the material be adding more of it is, as of course was along the linear search, the binary search, the bubbles toward those are the three most common covid algorithms. So you'll know pretty quickly one hand the bubble saw with the insertions sort. We'll talk about the Israelis and wrinklies. So we learned about those and we did the collections framework. And so we'll actually generate our own data structure based on some algorithms. We'll talk about the stack and the cube. And those are very common ones that you learn at any computer science program. So I'll go through all these what these mean. But if these kind of ring a bell or if they don't know where he is, because I'm going to go through these and I'm going to demo them here and these slides, I'm going to talk about algorithm efficiencies. There's three things we look at the amount of time it takes for an algorithm to execute, the amount of memory that's needed to execute and then the complexity, the of the performance. And one of the ways we talk about efficiency, it's called big O notation. So we use o one o n o and squared. So again, I, I don't you don't need to maintain a lot of this knowledge, but this is more of an introduction. Our survey of how people talk about algorithms, an example of one and two would be something like this. Oh, one is the time it takes to execute one simple line. And so all one is one line of code one one operation O and is like for example, a for loop that runs and times it's going to it's it's big o notation is o n if you're going to iterate through a collection of arrays or a double array, it's going to be O and squared. Right. You're going to go through a for loop with enough for loops. You're going to do end times end essentially. So again, you don't need to know too much of that, just kind of be the idea of big O notation. And if you're really into computer science, you would learn much more about a log and so forth and log or and factorial and all kinds of. There's just there's many, many it's obviously people, major and get there, this kind of stuff. So this is very, very much of a survey in terms of the terms. And then we'll see some of this when we get into our I actually write some algorithms out. For example, I'm going to say here's the here's the linear search bay, very basic out to find the value of the position of the number four. So here's an array with a set of numbers. So our job is going to find each value for and as a human, we can spot this immediately. But again, we need to write an algorithm that's going to have a computer. I think like a human, we need to think that that kind of way. So what are we going to do? We're going to go through each position in the array. Say, does that add an equal four and is the next and then you go four, does the next item go for it? Once it equals four. We're going to return to that index or it's going to say, yes, here's where that number was found. Now that process is again, humans do it very quickly and we need to write instructions on the computer. We need to actually go through this process and write an algorithm that will find that value. So the algorithm will look something like this. Right. We won't have a function with a with a set of data. And when our value, we're going to go through a four loops, going to go through each of those arrays and going to find the value based on that index and see if it equals our target. So that's the very basic set up of an algorithm. And I would have here's an example of the MAX runtime in the big O notation. So I'm going to go through various algorithms and I have slides on them, but it looks something like this and I just walk us through this process, how to think, how to have a computer, essentially think how do we how do we have these processes right now? So that's a very, very brief introduction to algorithms. We'll go through a number of these again in our course. I just kind of give a sample of how this goes here. But but the big thing here is that you get comfortable with traversing arrays, double arrays, and then thinking critically how to solve a problem. So algorithms are pretty critical. I'll probably do a whole separate course on data structures and algorithms, but I want to combine some into this course as if you're going to be a junior software developer. You should be familiar with some of these algorithms.