How do we even imagine a multidimensional array with more than three dimensions, can anyone give me an example of such | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do we even imagine a multidimensional array with more than three dimensions, can anyone give me an example of such

2nd Mar 2017, 12:37 AM
Isaac Onyach
Isaac Onyach - avatar
4 Answers
+ 9
Suppose a fly is moving in a 3 dimensional axes. And, we have to record its speed with respect to position and time. Now, the array becomes array[time][x][y][z], which has 4 dimensions. My example may be a little illogical but you get the concept, right?
2nd Mar 2017, 1:42 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 6
array = [1,2,[3,4,["hello"]]]
2nd Mar 2017, 1:19 AM
Chirag Bhansali
Chirag Bhansali - avatar
+ 1
Think of a tree. Like a family Heritage tree. If your array contains this: [4][3] then imagine a tree starting from four points. each oth the four points branch out in three. To know how many possible inputs there are, multiply 4 by 3. There are 12 possible inputs. After that, you can do any array. Just draw it out as trees branching down for each spot. A [7][4][9] array will start with 7 points. Each will branch into 4, and those branches will each branch into 9. This gives 252 inputs.
2nd Mar 2017, 2:20 AM
Rain
Rain - avatar
0
Thank you Rain and Krishna. I got it now thanks to your examples and a little more digging.
23rd Mar 2017, 10:27 PM
Isaac Onyach
Isaac Onyach - avatar