Cards (15)

  • An array is a variable that can hold a set of data items of the same data type, under a single identifier.
  • A two-dimensional array is particularly useful when representing data normally represented in a grid format.
  • A one-dimensional array can be sorted into ascending and descending order.
  • A bubble sort is an algorithm that is used to sort the values in an array into ascending or descending order.
  • A one-dimensional array is a linear array with a single index set. Contains one row of data with multiple elements; each element is identified by a unique index number.
  • An array index is a series of sequential numbers that reference the data items in an array.
  • Linear search is a method of searching an array. The process checks every element in the array sequentially until the required element is found or the end of the array is reached.
  • Two-dimensional arrays are arrays with two index sets. Contains multiple rows of data with multiple columns. Each individual element identified by a combination of both row and column index.
  • Bubble sort algorithm loops:
    • Iteration loop - controls the number of times the comparison loop will iterate. Should exit when no swaps have been made during one execution of the comparison loop.
    • Comparison loop - iterates through consecutive pairs of index numbers. Within the loop, the data values held at the pair of index locations are compared. If they are not in the correct order they are swapped.
  • When an array is declared, its size is defined. The size of an array can either be defined as part of the declaration or through the initialisation process.
  • Each element or data in an array can be referenced by its index. The index can be used to read or write values in an array.
  • A FOR loop can be used to iterate through the index location in an array. The loop counter is used to identify successive index numbers.
  • A WHILE loop can be used to search index locations in an array. The loop can be exited once a match to the search value is found.
  • Holding records which consist of more than one data item can be achieved by the use of multiple one-dimensional arrays. Data for each record is held at the same index position in the different arrays. As an alternative a two-dimensional array could be used with each row holding a different record.
  • Arrays can be sorted using either the inbuilt sort command or by running a bubble sort algorithm. Arrays holding either string or numerical data types can be sorted.