CS24 : An algorithm per day

Analytical look at the purpose of simple algorithms in flowchart and pseudocode format.  Introducing and practising trace tables to follow the progress of an algorithm.  Introduce breakpoint checking.

We are learning ...
  • How to determine the purpose of simple algorithms
  • How to write simple algorithms for a variety of purposes
So that we can ...
  • Determine the purpose of simple algorithms
    - describe algorithms in terms of their inputs, processing and output
    - use trace tables / dry run testing to determine the output of an algorithm
    - determine variable values in an algorithm at any given point
  • Write simple algorithms as
    - structured English
    - flowcharts
    - pseudocode
Click to engage

The purpose of algorithms
  I   O   A   E 

Let's start by looking at some algorithms to see what they do. Work on your own through the examples in the presentation, answering the questions on paper.

Writing simple algorithms
  I   O   A   E 

Work through the following algorithm examples. Try to complete one per day or as directed by your teacher. Your teacher will keep track of which challenges you have attempted.

You should produce your algorithm in "Structured English" and "Pseudocode" but remember ...
  • Make sure that your Pseudocode follows the suggested Pseudocode conventions;
  • Make sure that your Pseudocode does NOT look like Python;
You should then attempt to make your algorithm come to life in Flowgorithm - I've checked and they all can :)

It's OK to work in a group :)

Work together and check your proposed solutions with as many other students as possible! To help you out, I've made a super easy Structured English and Pseudocode Cheat Sheet which you can download. Noice :)

An flowchart solution to the algorithm challenge problem - nice!

Debugging code
  I   O   A   E 

Throughout your programming experience, you've been debugging code - the following exercise is a formal chance for you to show how you can fix syntax, runtime and semantic errors youself.

Task 3.1
Debugging Python code
Where we learn how to spot and correct errors in Python code

We are very used to debugging Python code and spotting errors that we or others have made in their programs. Here are some simple challenges for you.

Choose your level

Dip in at the level that you think you are currently capable of completing.

Download and complete the challenge

Each challenge gives you sample (incorrect) code plus the output that *should* be generated (but isn't). Complete the tasks on each sheet by replacing the blue writing (that tells you to replace it).

Give your completed challenges to your teacher

Make sure you have filled out your name and class on the worksheets and print them out for assessment.

Hungry for more?

You could try coding solutions to your algorithms using Python to see if they work - you will be asked to do this during the next topic anyway so you might as well get a head start :)