2.1 Algorithms with Selection and Repetition

0 阅读1分钟

1. Exam Points

  • Sequencing, selection and repetition
    • Selection in natural language.

2. Knowledge Points

(1) Algorithms with Selection and Repetition

  • The building blocks of algorithms (step-by-step process to solve a problem) include sequencing, selection, and repetition. (3 classical constructs) image.png
  • Selection occurs when a choice of how the execution of an algorithm will proceed is based on a true or false decision.
    • The condition should be a Boolean expression (result : true or false).
    • Example:
      image.png
  • Repetition is when a process repeats itself until a desired outcome is reached.
    • Example:
      image.png

3. Exercises