‫So now we're going to look at O of n squared.
‫So I'm going to bring this back from the last video where we had one for loop after another.
‫Except what I'm going to do is I'm going to change this where we have one for loop inside of another.
‫And when we do this, we're going to get a very different outcome.
‫So now let's flip over to VS code and take a look at this.
‫So there is our new function there with our nested for loops and we will run this with the number ten.
‫So over with our output.
‫I'm going to scroll to the top and you can see that this starts with zero zero and then it will go all
‫the way through to the bottom to nine nine.
‫So we pass this function, the number ten, and it printed out 100 lines.
‫So now let's flip back.
‫So this ran n times n times or n squared, and that is where we get o of n squared.
‫So now let's take a look at o of n squared on our graph and you can see that o of n squared grows much
‫faster than o of n, which is to say it is a lot less efficient than o of n.
‫So if you have two different ways that you could write a particular function and one way is O of n squared
‫and the other way is O of n, that would mean that o of n is going to be the far better way to write
‫that function.
‫And o of n squared will be the least efficient big o that we will see in this course.
‫And that is our overview.
‫Of O of n squared.