r/badcode • u/zshadowjon • Jul 29 '21
python Was doing some bug hunting and found essentially what was a sum to n function but of O(fuck) time complexity
1.2k
Upvotes
r/badcode • u/zshadowjon • Jul 29 '21
View all comments
Show parent comment
29
u/akren1 Jul 29 '21
Kind of picking on complexity here.
But python has built in big nums, so in theory time/space complexity is not O(1). It can be assumed to be for N in given range.
But it is still something to remember in the back of the mind.