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

*From*: pjhyett@xxxxxxxxx*Date*: 18 Nov 2005 13:22:56 -0800

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.

.

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

**Re: Filling 2d array in less than O(n^2)?***From:*A . L .

**Re: Filling 2d array in less than O(n^2)?***From:*Casey Hawthorne

- Prev by Date:
**Re: Can someone give me an example of this type of problem?** - Next by Date:
**Re: Filling 2d array in less than O(n^2)?** - Previous by thread:
**Problems with JFLAP** - Next by thread:
**Re: Filling 2d array in less than O(n^2)?** - Index(es):