This forum is now read-only. Please use our new forums at discuss.codecademy.com.

# 3.2 Maximum Element

This exercise is proving quite confusing. I still have only a foggy grasp of what "Big O" actually is. How do I find what the "Big O" is for this exercise?

Think visually. This idea may make it simple as well:

1) let's generalise the case for 3 arrays of length n:

pp

pp

3) Now do the same thing with two arrays:

4) Links to images (because they get cropped here):
http://i.imgur.com/0HhZc.png
http://i.imgur.com/4ToNF.png
http://i.imgur.com/JLLqh.png

Jacob Andersen over 4 years ago

Wow. Very nice, mate!

Raymond Dipasupil over 4 years ago

this is really really helpful!

OK, have managed to stumble upon the answer having looked up a couple of Youtube videos and looked on Stackoverflow. The answer is O(n^2). Both this video (http://www.youtube.com/watch?v=6Ol2JbwoJp0) and this forum (http://stackoverflow.com/questions/3255/big-o-how-do-you-calculate-approximate-it#_=_) were helpful in developing my understanding.

1 vote