Big Idea 3-4: Mathematical Expressions and Strings

Algorithms

What is an Algorithm?

Algorithm: a set of instructions that can accompish a specific task.

An Algorithm has Three Components

1) Sequencing: Algorithms do tasks in the order of specification. AP COMPUTER SCIENCE PRINCIPLES 2) Selection: Helps choose two different outcomes based off a decision to make. xAP COMPUTER SCIENCE PRINCIPLES 3) Iteration: If something is true, then the code repeats. An example of this would be a “For loop” AP COMPUTER SCIENCE PRINCIPLES

Two Ways to Represent Algorithms

1) Flowcharts: Use shapes and arrows to represent the steps of an algorithm. AP COMPUTER SCIENCE PRINCIPLES 2) Psudocode: A blend of human language and coding format. “Fake code.” AP COMPUTER SCIENCE PRINCIPLES

Hacks

  • Open up a new blog post and title it “Big Idea 3-4 (Mathematical Expressions and Strings) - Algorithm Hacks.”
  • Then, design an algorithm to add two numbers and display the result.
    • Number the steps in your algorithm
    • Use around 5-7 steps
    • HINT: DON’T FORGET THE “START” AND “STOP” STEPS
  • Lastly, make a flowchart OR psudocode reprsentation of the steps that you wrote.
    • For flowcharts: Use corrent shapes and lines. Feel free to ask to view the example above. Make your flowchart in google drawings.
    • For psudocode: Do five minutes of extra reaserch to understand the basic formatting and rules of psudocode