Daily Algorithm Practice
Still working through Big O.
This one is super simple.
If you notice, there are no loops, no recursion, etc. Just a conditional. Regardless of what the values for a and b are, the function is going to take what is mathematically the same amount of time. Thus, this function is doing a constant amount of work, so the runtime is simply O(1).
Comments
Post a Comment