Thursday, January 10, 2008

Array as an Abstract Data Type

  • What is an array?
    • An indexed, homogeneous collection of variables
    • Indexed from n-1 where n is the size
    • Multi dimensional
      • 1 index per dimension
    • The upper bound must be greater than or equal to the lower bound
  • An integer
    • is four bytes long, in sequence
  • to put one thing in to memory is called 'mapping'
  • row order is where the rows are separated and the columns are adjacent
    • column order is the opposite
  • if you have an array going from [-5 ..+6, +1 … 10, 3…5] of chess pieces
    • you would have an array of
      • -5, …, +6 of
        • An array of 1 , … , 10 of
          • An array of 3, …, 5 of chess pieces
  • Index – lower bound , to find the memory location of an object in a one dimensional array
    • For multi dimensional the 2nd 3rd… n dimensions start at the end point of the first but find an index the same way as a 1 dimensional array
  • Array Descriptor
    • Dimension count
      • For each dimension it needs to lower bound and upper bound and total size
      • A prototype array descriptor
        •     
  • A0 is the hypothetical location in memory where the first lower bound is found in memory.

No comments: