c++ - sum of all the elements in an array in less than O(n) -


i tried adding places , odd places in loop add both final answer making complexity o(n/2) need better way

you manage array , update sum when there changes. shifts time modifying operations , technically calculate (or not) sum in 0 time.


Comments

Popular posts from this blog

c - Calling a function within a loop -

vb.net - Unbound DataGridView add row with checkbox error -

How i fill combobox items in Radgridview manually using in vb.net -