what are the uses of Multidimensional arrays? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

what are the uses of Multidimensional arrays?

benefits and disadvantages

13th May 2017, 3:14 PM
PASINDU LAKSARA
PASINDU LAKSARA - avatar
3 Answers
+ 7
Multidimensional arrays are useful for representing any data that itself is multidimensional. That's a little circular, I know. Example time! Representing a game board (I've done tic tac toe and othello, for instance), but if your wanted to do 3D chess... I have done work in radio astronomy, and many times that data is multidimensional (most often time, frequency, and polarization) so you need these structures. Many types of modeling have these types of dependencies, so call for these arrays. In terms of downsides, you have to make your code clear, or it might be hard to read & maintain. In addition the memory requirements can be quite large. Instead of a 10 element array of ints taking up 10x the size of an int, a 10x10 takes 100, and 10x10x10 takes 1000. When working with pulsar data, I've worked with irreducible blocks of 100s of megabytes at a time, so processing those took a while. Hope this helps!
13th May 2017, 4:36 PM
Jim
Jim - avatar
+ 5
take a city for example: dimension 1 & 2: the street grid dimension 3: floors of buildings dimension 4: people living on the floor dimension 5: details of the people
13th May 2017, 6:45 PM
Mario L.
Mario L. - avatar
+ 1
Matrice
13th May 2017, 3:20 PM
MR Programmer
MR Programmer - avatar