5.1.4 Describe the characteristics of a tow-dimensional array

Definitions:
  • Array:
    • data structure defined by at least one array key/index
      • stored in such way that index used to calculate position
    • series of objects, which have the same size/type
      • e.g. array of integers
    • more than 1 dimension
      • 2D - matrix (2D grid)
        • has rows and columns
        • numbers listed in two dimensions
        • denoted using 2 numbers — e.g. column x row
      • 1D - vector (linear array)
        • either single row or column
        • used for storing numbers (data)
          one+dimension+array.jpg
          One dimensional arrays and how they work
1D Array:
  • int anArrayName[‘value’];
  • array.length;int
  • (i = 0, i < 5, i++) (algorithm)
  • to call up — base address + constant x index
  • defined data type
  • single row or column
  • Characterisitics
    1. defined data type
    2. stored without gaps in memory
      two-dimensionsl+array.jpg
      2 Dimensional Arrays and how they work
    3. has only single row OR column


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

5.1.6




For more information visit our Prezi: http://prezi.com/qykhdc2lvvom/?utm_campaign=share&utm_medium=copy&rc=ex0share


Created By: Lucie Magister and Max Kossatz
Last update: 15/12/2014

Sources: