On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.If you want to sum the elements you have to at-least look at all the elements.
So it'll always be O(N). it's the best you can do.
On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.If you want to sum the elements you have to at-least look at all the elements.
So it'll always be O(N). it's the best you can do.