Is the time complexity of the empty algorithm O(0)?

后端 未结 14 2269
暗喜
暗喜 2020-12-12 21:29

So given the following program:


Is the time complexity of this program O(0)? In other words, is 0 O(0)?

I thought answering this in a separate question

14条回答
  •  眼角桃花
    2020-12-12 22:30

    No. It's O(c) by convention whenever you don't have dependence on input size, where c is any positive constant (typically 1 is used - O(1) = O(12.37)).

提交回复
热议问题