Two-dimensional arrays: Difference between revisions
Mr. MacKenty (talk | contribs) (Created page with "right|frame|Programming basics<ref>http://www.flaticon.com/</ref> 2 Dimensional Arrays. ... Like a 1D array, a 2D array is a collection of data cells, all...") |
Mr. MacKenty (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[file:arrows.png|right|frame|Programming basics<ref>http://www.flaticon.com/</ref>]] | [[file:arrows.png|right|frame|Programming basics<ref>http://www.flaticon.com/</ref>]] | ||
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.<ref>http://www-ee.eng.hawaii.edu/~tep/EE160/Notes/Array/2darray.html</ref> | |||
Daniel Shiffman<ref> https://processing.org/tutorials/2darray/</ref> 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) | |||
== Standards == | == Standards == |
Revision as of 16:04, 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)
Standards[edit]
- Construct algorithms using pre- defined sub-programmes, one- dimensional arrays and/or collections.