Add all elements to each other in an array in O (n) time

Let's assume an array has three elements:



What I want to know is that it is possible to add each element of the array to each other so that the time complexity is O (n) ?. The result should be




source to share

1 answer

No, it is O(n^2)


Now let's see if someone proves to me that I'm wrong ... even better, someone proved my statement correctly - see the comments below.



All Articles