5.1.5 - Construct algorithms using two dimensional arrays.


2D Arrays
  • a = new double [row] [column];
  • two indices - row, then column number
  • to call up: base address + ((row + index(1)) x (column + index(2))
  • Characteristics:
    • defined data type, but may have different variables (e.g. age & height)
    • stored without gaps in memory
    • has rows and columns
    • matrix (2D grid)

A good source for explanation is:
http://www.informit.com/articles/article.aspx?p=2180072&seqNum=5

Screen Shot 2015-04-18 at 20.29.06.png
Source: http://www.informit.com/articles/article.aspx?p=2180072&seqNum=5




Pseudo Code:


  • Declare a 2D array:



Screen Shot 2015-04-21 at 10.13.52.png

  • Iterate through:
    * Add an element:
    * Cut an element:


Created By: Lucie Magister
Last update: 18/04/2015

Sources: