programming

Subdecks (4)

Cards (50)

  • Errors in algorithms
    • Syntax errors: program can't finish/fail
    • Logical errors: occur when the program finishes but produces the wrong output
  • SQL
    • Primary key: unique identifier (no repeat values)
    • SELECT: list the fields to be displayed
    • FROM: identifies the table
    • WHERE: identifies the search criteria
    • AND
    • Record: a row in table (that is collection of fields)
    • Field: column in table
    • Data types: text/alphanumeric, date/time
  • Standard methods of solution
    • Linear search, bubble sort, totalling, counting, finding maximum, minimum and average value
  • Linear search
    Iterate through elements until match found, then found = true (break iteration loop), else found = false OUTPUT error
  • Bubble sort

    n = length of array, repeat 0 TO n-1 times (pass = repeat through every element in array), all pairs of elements compared and swapped (each j increment represent index, moves onto next pair), largest element will bubble up to last, until j = n - i (number of passes) - 1. minus i means ignore swapping last element as its already sorted
  • Totalling
    Keeping a running total of values entered into the algorithm e.g totalling a receipt, total = total + score[i]
  • Counting
    Keeps track of the number of times an action has been performed
  • Finding maximum, minimum and average value
    max = score[1], min = score[1], iterate: if score[i] > max DO max = score[i], avg = total / score
  • Dry-run of an algorithm

    Used to follow algorithms and make sure they perform the required task correctly
  • different methods to design and construct a solution to a problem
    1. structure diagramsflowcharts – pseudocode
  • 3) loop
    1. 7.1 Count-controlled (FOR) loops
    2) 7.2 Post-condition (REPEAT) loops
    3) 7.3 Pre-condition (WHILE) loops