How do I visualize arrays with 3 or 4 dimensions?

# Visualizing multi dimensional array

Page 1 of 1## 4 Replies - 995 Views - Last Post: 16 January 2013 - 11:32 AM

##
**Replies To:** Visualizing multi dimensional array

### #2

## Re: Visualizing multi dimensional array

Posted 14 January 2013 - 08:25 AM

What story or message are you trying to emphasize to the viewer?

Or do you merely need a way for the viewer to browse through the data?

Or do you merely need a way for the viewer to browse through the data?

### #3

## Re: Visualizing multi dimensional array

Posted 14 January 2013 - 10:02 PM

I want to use it to solve problems related to multi-dimensional arrays.

eg.

int a[2][2][2]={1,2,3,4,5,6,7,9};

What is the value of a[1][0][1]?

Thanks

eg.

int a[2][2][2]={1,2,3,4,5,6,7,9};

What is the value of a[1][0][1]?

Thanks

### #4

## Re: Visualizing multi dimensional array

Posted 14 January 2013 - 10:12 PM

2D arrays can be conceptually visualized as a 2D grid of values. Adding a dimension to a 2D array will result in a 3D array, which can be visualized as a cube of elements (remember that data in memory is physically layed out continuously).

The value of a[1][0][1] can be conceptually represented as the coordinate (1,0,1) in the 3D cube of values.

This might help clarify

Quote

Quote

int a[2][2][2]={1,2,3,4,5,6,7,9};

What is the value of a[1][0][1]?

What is the value of a[1][0][1]?

The value of a[1][0][1] can be conceptually represented as the coordinate (1,0,1) in the 3D cube of values.

This might help clarify

### #5

## Re: Visualizing multi dimensional array

Posted 16 January 2013 - 11:32 AM

rnty, on 14 January 2013 - 08:09 AM, said:

How do I visualize arrays with 3 or 4 dimensions?

Of course, the array is laid out in memory in a contiguous fashion, regardless of how many dimensions.

(The following symbols are simply used to represent a space: . ' ,).

int a[2] = (1,2)

int a[2][2] = (1,2...3,4)

int a[2][2][2] = (1,2...3,4) ..... (5,6...7,8)

int a[2][2][2][2] = (1,2...3,4) ..... (5,6...7,8) '''''''''''''' (9,10...11,12) .....(13,14...15,16)

The leftmost indice makes the largest course selection, and the rightmost indice zeros in on the single data element of interest. Of course, keep in mind indices start at 0:

a[0] = (

**1**,2)

a[

**1**][x] = (

**3,4**) // x would then select 3 or 4;

a[

**0**][x][y] =

**(1,2...3,4)**.....

a[

**1**][x][y][z] = (

**(9,10...11,12) ......(13,14...15,16**)

a[1][0][1][0] = 11

a[0][0][0][0] = 1

a[0][x][y][z] =

**(1,2...3,4) ..... (5,6...7,8)**'''''''''''''' (

Watch this progression:

a[1][0][0][1] = 10:

a[

**1**][x][y][z] = (

**(9,10...11,12) .....(13,14...15,16)**

a[

**1**][

**0**][y][z] =

**(9,10...11,12)**.....(

a[

**1**][

**0**][

**0**][z] =

**(9,10**...

a[

**1**][

**0**][

**0**][

**1**] =

**10**...

Also, if you were to toggle sequentially through an array, the right most indice would increase the fastest while the leftmost indice would increase the slowest, just like on a car's odometer.

This post has been edited by **Mrk**: 16 January 2013 - 12:15 PM

Page 1 of 1