Two-dimensional arrays: Difference between revisions
Mr. MacKenty (talk | contribs) No edit summary |
Mr. MacKenty (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
(lettuce, tomatoes) and (steak, mashed potatoes) and (cake, ice cream) | (lettuce, tomatoes) and (steak, mashed potatoes) and (cake, ice cream) | ||
== a good video == | |||
This video has some references to Java, but it should help you understand the very basics of 2d arrays : https://www.youtube.com/watch?v=nySZfYSVspo | |||
== Standards == | == Standards == |
Revision as of 16:07, 10 December 2018
Like a 1D array, a 2D array is a collection of data cells, all of the same type, which can be given a single name. However, a 2D array is organized as a matrix with a number of rows and columns.[2]
Daniel Shiffman[3] writes: an array keeps track of multiple pieces of information in linear order, a one-dimensional list. However, the data associated with certain systems (a digital image, a board game, etc.) lives in two dimensions. To visualize this data, we need a multi-dimensional data structure, that is, a multi-dimensional array. A two-dimensional array is really nothing more than an array of arrays (a three-dimensional array is an array of arrays of arrays). Think of your dinner. You could have a one-dimensional list of everything you eat:
(lettuce, tomatoes, steak, mashed potatoes, cake, ice cream)
Or you could have a two-dimensional list of three courses, each containing two things you eat:
(lettuce, tomatoes) and (steak, mashed potatoes) and (cake, ice cream)
a good video[edit]
This video has some references to Java, but it should help you understand the very basics of 2d arrays : https://www.youtube.com/watch?v=nySZfYSVspo
Standards[edit]
- Construct algorithms using pre- defined sub-programmes, one- dimensional arrays and/or collections.