Ch 3- Algorithms

Cards (9)

  • *WHAT IS AN ALGORITHM*
    An algorithm is a set of instructions for solving a problem or completing a task
  • *A GOOD ALGORITHM*
    -          There must be a limited number of steps
    -          The steps must be easy to understand and follow, detailed and specific, clear and unambiguous
    -          Each step should consist of a single task and be at the most basic level that cannot be broken into simpler tasks
    -          All repetitions must have clear ending conditions
    -          There must be at least one result
  • *COMPARING ALGORITHMS*
    When we compare algorithms we can reference their precision (how accurately and reliably an algorithm solves a problem) and order (the total number of steps needed to solve a problem)
  • *DESIGNING AN ALGORITHMS*     
    • Understand the problem
    • Define the desired solution or output
    • Define the inputs
    • Design a set of steps to complete the task
    • Test the algorithm
    • Update the algorithm
  • *FLOWCHARTS*
    • An algorithm is a series of steps to solve a problem or carry out a task
    • A flowchart is a common tool used to help plan and write down the steps needed
  • *ARITHMETIC OPERATORS*
    • Addition -> +
    • Subtraction -> -
    • Multiplication -> *
    • Division -> /
    • Exponentiation -> **
    • Integer Division -> div or //
    • Remainder -> mod or %
  • *COUNTING AND TOTALLING*
    The statement "count=count + 1" means "Add 1 to the variable (called count)"
  • *IPO (INPUT, PROCESS, OUTPUT) TABLES*
    • Input (Variable name and data type)
    • Process (What? and How?)
    • Output (What and Format)
  • *TRACE TABLES*
    How to set up?
    Column headers= identify all variables that change their values during the execution of the algorithm
    Rows= each row will represent a point in time or specific step in the algorithms execution