This forum is now read-only. Please use our new forums! Go to forums
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?
Answer 50d43393d4bcb2de04001cc9
Think visually. This idea may make it simple as well:
- let’s generalise the case for 3 arrays of length n:
pp
- start with the simplest case:
pp
- Now do the same thing with two arrays:
- 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
Answer 4ff72596a1a6800003035c42
5 votes
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.
Answer 50ea7d1458ee6774ba0053b4
1 vote
It’s two times nested, so you have a n^2 notation. i.e.O(n^2)
1 comments
Sofia Perwallius almost 10 years
Thanks
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
2 comments
Wow. Very nice, mate!
this is really really helpful!