There are only a few aspects that change the complexity of an algorithm, those that have been shown to proportionally increase the total time required of an algorithm.
These are as follows:
- An arithmetic operation (10 + 30)
- An assignment (let x = 10)
- A test (x == 10)
- A read or write of a basic type (u32, bool, and so on)
If a piece of code only does one of these operations, it is one step, that is, O(1), and whenever there is a choice (if or match), the more complex branch has to be picked. Regardless of any input parameters, it will be the same number of steps—or constant time. If they are run in a loop, things get more interesting.