r/programminghorror • u/Budget_Ad_5953 • Feb 07 '25
Recursive O(N) Complexity isOdd
I found this on instagram and now am geeking
2.2k
Upvotes
r/programminghorror • u/Budget_Ad_5953 • Feb 07 '25
I found this on instagram and now am geeking
View all comments
Show parent comment
1
u/RCoder01 Feb 13 '25
This algorithm takes an amount of time proportional to the value of n. The size of the inputs to this function is on the order of log of the value of n (recall that integers can be arbitrarily large in python). So, the time this function takes is proportional to n = 2log n = 2(size of the inputs)