I believe it is 3n+5n^2+1 but I am not 100 percent sure. If I am wrong can someone explain to me why?
Asked
Active
Viewed 113 times
-5
-
you are correct – Eran Sep 04 '18 at 07:35
-
5I'm voting to close this question as off-topic because its a math question, not computing – vikingsteve Sep 04 '18 at 07:36
-
Big O Notation is a math question? I – hotrod28 Sep 04 '18 at 07:37
-
@hotrod28 Not necessarily, but this is a maths question. – khelwood Sep 04 '18 at 07:43
1 Answers
3
3n + 5n^2 + 1 | applying Big-O notation for the single terms
= O(3n) + O(5n^2) + O(1) | leaving out constant multipliers
= O(n) + O(n^2) + O(1) | taking the one with the maximum power
= O(n^2)
=> quadratic time
So you are right, the first option is the quadratic one.
If it was 3n + 5n^(2 + 1), then it would be qubical due to 5^(2 + 1) = 5^3.

deHaar
- 17,687
- 10
- 38
- 51