Time complexity of int comparison

Hii guys I wanna know about the time complexity of int comparison in c++ also what is the time complexity of multiplication and other basic operations can anybody give a cheat sheet sort of thing help me Thanks in Advance

Well, a rule of thumb is to consider addition, multiplication, division and modulo, < , > , == as O(1) operations. However, division and modulo are a bit more “costly” operations. But usually you can neglect it. (Assuming your time limit is 1s and your program performs < ~1e8 operations, you won’t get TLE for sure).

1 Like

but in general, multiplication is more costly than addition, right ?