I just formulated an algorithm for a problem and I analysed it to be O(2m+n) but we are supposed to get O(m+n) so I want to know if O(2m+n) = O(m+n).
Asked
Active
Viewed 49 times
0
-
For Big-O analysis in the common sense, given that `m` and `n` are two independent variables, `O(m+n)` itself would generally reduce to `O(m)` or `O(n)` depending on which variable we choose to study (in the context on the asymptotic behaviour of our algorithm w.r.t. one of these variables). _"The implicit assumption is that these properties extend to more than one variable. In this paper, we demonstrate that this assumption, which seems to pervade the computing literature, is invalid."_ from [On Asymptotic Notation with Multiple Variables](http://people.cis.ksu.edu/~rhowell/asymptotic.pdf) – dfrib Feb 11 '16 at 12:05
1 Answers
3
Yes, it is. Big O ignores constants. So O(m +n)
is the same as O(100000m + 50n)

Community
- 1
- 1

Salvador Dali
- 214,103
- 147
- 703
- 753