Re: Filling 2d array in less than O(n^2)?



Forget about writing the array. When you need to read element
a[i][j], substitute the value i+j. Then "filling" is an O(1) operation.

.