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

*From*: Casey Hawthorne <caseyhHAMMER_TIME@xxxxxxxx>*Date*: Fri, 18 Nov 2005 21:54:52 GMT

Don't you HAVE to touch each element at least once?

Are you thinking of vector processing solutions?

pjhyett@xxxxxxxxx wrote:

>standard 2d array filling with increasing numbers for rows and columns:

>

>for(int i=0;i<n;i++)

> for(int j=0;j<n;j++)

> a[i][j] = i + j;

>

>problem is it's O(n^2). I'm looking for a method to decrease the time,

>any suggestions? I'm googling for dynamic programming solutions, but

>not coming up with much.

--

Regards,

Casey

.

**Follow-Ups**:**Re: Filling 2d array in less than O(n^2)?***From:*pjhyett

**References**:**Filling 2d array in less than O(n^2)?***From:*pjhyett

- Prev by Date:
**Filling 2d array in less than O(n^2)?** - Next by Date:
**Re: Filling 2d array in less than O(n^2)?** - Previous by thread:
**Filling 2d array in less than O(n^2)?** - Next by thread:
**Re: Filling 2d array in less than O(n^2)?** - Index(es):