computer science - Big O estimate for summing up an array -


If I have 1 million integers it is considered to be O (n) because I have to add N-1 to operate . correct?

If you can add two elements in o (1), then n elements in short (N), yes. If they can take more time, then no. For example, if all the elements are signed with 32-bit integers, but you want the exact amount (zodiac mod 2 32 ) then it can be larger as n & middot; (2 32 and minus; 1) In that situation, the o (n log n) will take.


Comments