So i’m 15 years old and i don’t understand these log and n stuff… Could please someone explain this lecture in more understandable way? Thanks!

I dont really know an easy way to explain it, maybe someone else can help with that. But its a precalculus thing. If you take that class itll be there

This might help. Give it a read and hopefully it gets you there.

However, to be honest… When you’re coding you will eventually begin to think, “How long will this take?”. It is natural. You will eventually understand that something is going to take longer and you won’t know what O notation it is. I honestly didn’t get it even after college and I still do well.

However, learning it earlier and understanding it can help you miss a LOT of headaches that come from not understanding it. Understanding how many iterations it takes for something small is easy, but grasping a larger operation takes time. O notation helps you grasp it faster.

“Log n” just means the logarithm using a base (such as 2) of the number “n.”

That is, if you take the number 2 (the base) and raise it to the power “log n,” you get n as the result.

Roughly speaking, if you have an algorithm with a big O of log n (base 2, say), and you DOUBLE the size of n, you only add ONE additional operation or cycle.

Thus, if I need to search through 32,000 items and my algorithm’s big O is log n, I’ll need about 15 operations. That’s because 2 raised to the 15th power is about 32,000.

Let’s say I need to search through twice as many items using the same algorithm. I’ll only need to add one additional operation. Because 2 to the 16th power will get me to about 65,000.

So if the size of the problem (n) is 65,000, and the operations needed to solve it is log n, you get 16 for log n (using base 2). That 16 is your “number of operations needed.”

Here’s a great video on algorithms and Big O: https://www.youtube.com/watch?v=z6qATR0VLnk

(watch starting at 20:45)