need help defining Constant memory requirement
heikowu at ceosg.de
Mon Sep 20 04:20:33 EDT 2004
Am Sonntag, 19. September 2004 23:28 schrieb Jani Yusef:
> Got it!! Thanks for your help.
> Here is my revised and working code
> for a in i:
> return (sum1-sum0)%len(i)
> I think my main malfunction was with thinking that this was mor
> ecomplex tna it was. By refocusing on the simple problem statement as
> suggested the solution came easier. Thanks again.
Well, actually, as Tim Peters already said, the function really isn't O(1) in
space requirement, because len(i) and sum(i) grow with O(log(n))... But okay,
probably your instructor just overlooked this...
More information about the Python-list