# AP Computer Science 4.1 Standard Data Structures

AP | AP Computer Science |

AP Computer Science | Standard Data Structures |

Computer Science | AP Computer Science |

Language | English Language |

Program Analysis | Numerical representations of integers |

Test Prep | AP Computer Science |

### Transcript

call it by its index what if you want another row of data well sure you could

make a whole new separate array but that's little clunky this is more of a

job for a two-dimensional array add an extra set of brackets and well off we go [array with added set of brackets]

we can reference anything in this array by using two indices horizontal and

vertical or clever names x and y want to get wild I'll we can keep going on to [Men in a boxing ring ready to fight]

three dimensional arrays are totally doable and turn our square into a

cube and again we'd be using the arrays three indices so we can reference [Cube with an array]

elements anywhere along its three axes so now we have a three dimensional array

full of data sounds very futuristic already but we can go further than that [Man hurdling over arrays]

what would a fourth dimension be like where would you put it? easy! well right

next to it just like a complaint from your physicist friend all right if a

one-dimensional array gave us a number line 2D gave us a square and 3D

gives us a cube then 4D is a number line made of cubes did we just blow your [Explosion occurs]

mind all right and a 5d array well you guessed it a grid made of cubes.. 6D? a

cube made of cubes.. 7D a number line made of a cube made of cubes you can see

where this is headed into infinity well the Java language specification states [Buzz flys away and java specification book appears]

that you could theoretically have infinite dimensions but the Java Virtual

Machine the thing that actually excutes the code sets a limit of 250 five [Laptop with 255 dimensions on the screen]

dimensions thankfully for our brains the need for that many dimensions doesn't

come up all that often in fact an array of more than three dimensions is [Mans head opens and arrays enter inside]

downright rare and this question is asking us what the length of a certain

two-dimensional array would be logically speaking

since we're dealing with a 2d array it'd makes sense to multiply width x height

like measuring a rectangle like 12 times 10 but that's not how the length function

works in Java it returns a simple integer based on the length of a single

dimension in this case the first dimension because we didn't specify a [Java code line circled]

deeper one that said the answer was right in front of our faces the entire

time it's just as well.