Notes

  • An algorithm is a finite set of instruction that accomplish a task
    • it can be expressed by natural language, diagrams, etc.
    • Every algorithm can be created by a mixture of sequencing, selection, and iteration
  • A sequence is the order of how to do something to achieve a result
    • i.e. how you follow the instructions from a teacher
  • A selection allows an algorithm to make a decision based on if a condition is met
    • i.e. when your car is out of fuel, you go to the gas station to fill your car, but if your car is full you wouldn't go to the gas station
  • An iteration is a loop and doing something again until a condition is met
    • i.e. you put away your computer when you are finished with your work
  • Sequential statements are used in processes to specify how signals are assigned
  • After all the sequential statements in the process are executed the signals are assigned in order their new values
  • Arithmetic operator is language that use addition (+), subtraction (-), multiplication (*), division(/), and modulus (%)
  • String concatenation joins two or more strings end-to-end to make a new string
  • A substring is part of an existing string

Hacks

#1 Describe the parts of an algorithm

Sequencing: The whole algorithm together is an example of sequencing

Selection: 3. If number = item, display "item found"

Iteration: 4. If there are more numbers in the list, go back to Step 2

#2 Evaluate the arithmetic expression

num1 = 5
num2 = 5 3 = 15
num3 = 15 / 5
(9 % 2) 4 = 3 1 4 = 12
result = (12 % 5 + 15) % 12
3 / 5 = 17 % 12 * 3 / 5 = 3

The answer is 3

#3 Crossword puzzle

  1. down - iteration
  2. down - selection
  3. across - sequence

#4 Quiz