Practice Algorithm in CS Thinking

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

A step-by-step set of instructions for solving a problem or accomplishing a specific task.

A recipe for solving problemsβ€”follow the steps, get the answer.

Example 1

easy
Write an algorithm (as numbered steps) for making a cup of tea.

Example 2

medium
Here is an algorithm: 1. Set total = 0. 2. For each number in the list [3, 7, 2, 8]: add the number to total. 3. Output total. What does this algorithm compute?

Example 3

easy
Write an algorithm to find the largest number in a list of three numbers: A, B, C.

Example 4

easy
A recipe says, 'Add sugar until it tastes right.' Explain why this is a poor algorithm step and rewrite it so it is precise.