I think even O(logn) time isn't needed at all. We can store bi = sum(array, array + i) for any i that is legal. The result will occupy O(n) memory. And then sum(array + i, array + j) can be easily calculated by subtracting bi-1 from bj when i > 0. We just need O(1) time for the calculation.
- [algogeeks] Re: Sum of sub array [EMAIL PROTECTED]
- [algogeeks] Re: Sum of sub array SPX2
- [algogeeks] Re: Sum of sub array JeffCameron
