Best possible order

If we’re talking about which one would be better, O(n) will always be the best, that’s a no-brainer. However, managing to get an O(n) algorithm is not always feasible.

I initially though the best we could do was an O(n*log n + n), but reading the topics here and looking at the rest of the lecture I saw that it is possible to achieve an O(n) in this case.

I guess I’m just not cut for this programming thing.

Don’t beat yourself up! Reducing big O run-time is a major field of research precisely because it’s hard! Keep going, don’t give up. Big O notation is a challenging thing and it’ll take time to get your head around it. It won’t stop you from making games though!

1 Like

I know I am having trouble myself understanding Big O notation. I had to research this to understand it. I am not giving up on programming games. I still want to learn how to program correctly using C++. With every language you need to practice and learn as you Practice.

1 Like

Hello dear Community,

let me explain with my words: O(n) is when you input one item and the machine needs 1 minutes time to calculate the item. Then, you put two items in the machine and it needs 2 minutes - that is O(n).

In case of O(n^2) the machine would need 4 minutes with two items and 9 minutes with three items.

Hopefully, it is now more clear to you.

Cheers
Kevin

Privacy & Terms