What Are Algorithms and Why They're Important
A free video tutorial from Tim Short
Dev / Train / Recuit
4.3 instructor rating • 4 courses • 125,308 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] I welcome back and I want to talk about algorithms now and this is actually something where a lot of job of course is actually fall short. They'll teach some of the basics for object oriented programming erotica publications. You'll learn about the collections framework and some data structures. But again where we go the extra mile is we one teach you algorithms. Well what I say An Introduction to Computer Science and talk about this is 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 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 using and our job 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 analyzes right. So how we think we're able to do as humans were able to do things incredibly fast intuitively because of our Because of our intelligence because of that the wave and intelligently designed. And so we're able to make connections and come to conclusions very fast. Computers have high processing power that we actually need to program them. We need to think we need to tell them how to think we need to find them instructions. So it kind of this term the algorithms algorithms are systematic approach to methodically and efficiently solve problems using repetition and calculation with complex data structures. This is my definition that helps us make through it 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've got a if you majored in computer science you ought to spend a lot of time working with algorithms learning the basic ones enhancing them. They need to be very very complex. But this is where computer scientists make their money from Hayling 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 come 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 this course goes along the linear search the binary search the bubbles sort those are the three most common common algorithms so you'll notice pretty quickly one hands the bubble sort with the insertion sort. We'll talk about the rails and linked list so we learn about those when we did the collections framework and so will actually generate our own data structure based on some algorithms. We'll talk about the stack in the queue. 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 it is because I'm going to go through these and I'm going to demo them here and these slides we're 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 of the sort of the performance. And one of the ways we talk about efficiency is called Big O notation. So we use 0 1 0 and 0 and square it. So again I don't. You don't need to maintain a lot of that knowledge but this is more of an introduction or survey of how people talk about algorithms and example. 0 1 and 2 would be some like this so 0 1 is the time it takes to execute one simple line. And so 0 1 is one line of code 1 one operation. 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 0 and square it right you're going to go through a for loop within a for loop are you're going to do and times and essentially. So again you don't need to know too much that just kind of note the idea of Big O notation. And if you're really into computer science you learn much more about oh log and so forth and. And factorial and all kinds of there's just there's many more it's obviously people Major and get their PC and his 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. And I actually write some algorithms out for example I'm going to say here's the here's the linear search very basic and find the value of the position of the number four. So here's an array a set of numbers. So our job is going to find each value of four. And as a human we can spot this immediately. But again we need an algorithm that's going to have a computer think like a human. We need to think that that kind of way so what are you going to do. We're going to go through each position in the array. Say does that equal four. And is it next. And then you go for does the next. I didn't go for 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 have a function with with a set of data what are value going to go through a for loop is going to go through each of those arrays is 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 when. Here's an example of an X run time in the Big O notation. So when it goes 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 sense we think how do we how to 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 just going to 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 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 in this course as if you're going to be a junior software developer you should be there with some of these algorithms.