Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Two Dementional Array Spiral Fill

1. ## Two Dementional Array Spiral Fill

How could i write two methods... one recursive and one not to fill a two dementional array of size n.

ex. 5 x 5 array

0 1 2 3 4
15 16 17 18 5
14 23 24 19 6
12 22 21 20 7
12 11 10 9 8

the non-recursive routine would be like void spiralFill(int [][]a, int n) where it spiral fills the first n rows and columns

• There are a couple of ways to do this, but we wont do it for you! What have you come up with for ideas thus far?

For the non-recursive way, think about how you would go adding to each element in the array. It may help to do the non-recursive part first, then move onto the recursive part (assuming you're a newer student, this would be easier).

Think about how he array's are filled, and how you could possibly loop that.

Let us know what you come up with.

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•