I am estimating the worst-case time complexity of this piece of code:
if (condition) {
// loop over A
} else {
// loop over B
}
such that A and B are disjoint sets and |A| + |B| = C. In my opinion, the worst-case time complexity is O(max(|A|, |B|)) = O(C). Could you please tell me if it is correct?
Also a side question, if I have a complexity like O(N(1 + M)), do I have the right to drop 1 and keep only O(NM) as the final complexity?
I apologize if my question is too basic. I haven't touched complexity analysis for a long time.
Thank you!