3.9 Developing Algorithms

39 阅读1分钟

1. Exam Points

  • Represent algorithms
    • natural language
    • flowchart
    • pseudocode
    • programming language
  • Compare two given algorithms
  • Predict the result or behavior of algorithms.
  • Create algorithms by modifying existing algorithms
  • Equivalent Boolean expressions of conditionals

2. Knowledge Points

(1) Represent Algorithms

  • Different ways to represent algorithms
    • natural language
    • flowchart
    • pseudocode
    • programming language

(2) Developing Algorithms

  • The way statements are sequenced and combined in a program determines the computed result.
  • Algorithms that appear similar can yield different results.
    • Example:
      image.png image.png
  • Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values.
    • Example:
      image.png
  • Algorithms can be written in different ways and still accomplish the same tasks.
    • Example:
      image.png image.png
  • Algorithms can be newly created from an idea, by combining existing algorithms, or by modifying existing algorithms.
  • Benifits of using existing algorithms: Using existing correct algorithms as building blocks for constructing another algorithm has benefits such as reducing development time, reducing testing, and simplifying the identification of errors.

(3) Equivalent boolean expressions for conditional statements

  • Some conditional statements can be written as equivalent Boolean expressions, and vice versa.
  • Example:
    image.png

3. Exercises