I have this code and I need to figure out its Big O notation but I'm very unsure about it. My idea was that it should be some large integer times n
because everything but the while
-loop should be constant. Hence it would be O(n)
. Is that correct?
(I know that the code does not make sense. I have changed it so that its actual purpose is no longer recognizable. So c==3, d==4, e==5 and f==6 aren't always true.)
a,b,i = 3,0,0
mystring = input("Input your string")
if a == 3:
print(a)
else:
print("a is not 3")
while (b < 10) and (i < 4*len(mystring)):
c,d = 3,4
if (c==3 and d==4):
e,f = 5,6
if (e==5 and f==6):
print("good so far")
b +=1
else:
i +=1
else:
i +=1
if i >= 4*len(mystring):
print("maximum reached")
else:
print(i)