O(n+m) vs O(n+2m) time complexity
I would like to try an intuitive explanation.
Assume your algorithm works in $2m$ time units on your current machine. If you run it on a machine twice as fast, then it takes $m$ times units. As we do not know (and do not care) on which machine(s) the algorithm will run, this makes the $2$ factor irrelevant. This is what the big-$O$ notation captures, in a sense.
(In addition, if we know that $n&gt;m$ then we have $3n &gt; n+2m$, and so anything below $n+2m$ also is below $3n$. As big-$O$ deals with upper bound, this means that $O(n+2m)$ complexity is, in this case, in $O(3n)$ complexity which, as explained above, is nothing but $O(n)$.)
Hope this helps.