I know if we use constant number of operation our time complexity
is constant
.
so what if we have following scenario:
for example an operation uses an array of fixed size 1000
. no matter what that operation or what size of the input is the amount of computation will always be (1000 ^ 1000)
(the computation is regardless of the size of input)
can we still say that its time complexity still O(1)
, even our number of operation is (1000^1000)
?
Yes, any constant. That "big O" thing is a set of functions, following this definition
As you can see here, you may simply pick
c
as your huge constant, and thereby put it in the class O(1).That should not be taken as a statement about real life performance, for obvious reasons.