EEE1004: Algorithm Design Exercises

Here is the list of problems which you should attempt after you have done your basic Familiarisation Exercises. Some of these problems and solutions to them will be considered during your classroom tutorials. Others will be given to you as exercises. Their solutions (design diagrams) must be shown to your practical tutors and submitted on paper, as reports with your name and student number, to the EECE school reception. These solutions will contribute to your overall mark for the Assignment 0.
  1. Design an algorithm to calculate the average value of a set of hourly temperature readings during 24 hours.
    {this exercise will teach you how to deal with repetition}

  2. Design an algorithm for calculating the MIN and MAX values of those readings.
    {repetition with an "if-then" (no "else" part) selection}

  3. Design an algorithm to produce a histrogram of those readings for a given set of intervals between MIN and MAX (see exercise (2)).
    (Hint: take three equal intervals: lower, medium, higher. A histogram is the list of data that shows how many of your readings fall into each of those intervals.)
    {repetition and multi-way selection}

  4. Design an algorithm to fill a square checkerboard with the following pattern of 0's and 1's (i.e. 1's form a cross out of the two main diagonals of the square)

    10001
    01010
    00100
    01010
    10001


    { repetition with the loop counter used in the body of the loop}