om .c s er ap eP m e tr .X w w w Scheme of work – Cambridge IGCSE® Computer Studies (US) 0441 Unit 4: Algorithm design and testing Recommended prior knowledge Students need to have studied Unit 3 before starting this unit. Context Students need to study this unit before Unit 5 and before or alongside Unit 12. For both Units 4 and 5, together with Unit 6, Computer Studies Support Booklet – Part 3 (http://teachers.cie.org.uk/docs/dynamic/31798.pdf) provides notes on section 3 of the syllabus and practice problems (with answers in Computer Studies Support Booklet – Answers (http://teachers.cie.org.uk/docs/dynamic/31801.pdf). Outline Defining the scope of separate modules, designing algorithms that relate clearly to the requirements of the system and identifying hardware needs arising from the required output. The use of structure diagrams for top-down design, program flowcharts and libraries of subroutines. Using dry runs and trace tables to work out the purpose of an algorithm, suggesting and using suitable test data and identifying and correcting errors in algorithms. Study of these topics can be illustrated by case studies of existing solutions to problems and reinforced through practical work. Syllabus ref Learning objectives 3.1 Introduction v1 2Y05 Suggested teaching activities Learning resources Students could be introduced to the need for algorithms in developing software solutions as follows: 1. Ask for a volunteer. Write a small set of random numbers on a board and ask the volunteer to sort them into ascending numerical order. Explain that the volunteer is using an unseen strategy or algorithm. 2. Ask the volunteer to look away. Write a new small set of random numbers on the board and ask the volunteer to give you instructions for sorting them, asking necessary questions such as “What is the first number?” Once a volunteer has succeeded in this task, explain that the volunteer has revealed their algorithm. 3. Ask the successful volunteer to list the instructions for sorting a new small set of random numbers before you write the new set on the board. You can try to pick numbers that will not work with the volunteer’s instructions. Execute the list of instructions without any Cambridge IGCSE Computer Studies (US) 0441 1 Syllabus ref 3.1.1 Learning objectives Make an overall plan Suggested teaching activities further intervention from the volunteer. If the instructions fail to achieve the sort, allow the volunteer or other students to amend the instructions and start the procedure from the beginning. Once the instructions are successful, explain that this is an algorithm. Students should perform practical exercises, using appropriate tools from 3.1.2 below, to: • use top-down design to define the scope of separate modules within each solution • design algorithms to meet the requirements of modules • explain algorithms and how they relate to a solution • explain how hardware needs arise from the input and output required for a solution. Learning resources LWS coursebook pp. 240–2 http://raptor.martincarlisle.com/Introduction%20to%20Algo rithmic%20Thinking.doc An introduction to algorithmic thinking It may be useful to point out that: • a computer must store input data prior to processing and (usually) the results of processing after processing in memory locations, or “variables”, which we label with identifiers • even within structure diagrams and program flowcharts, we can use pseudocode as shorthand for the process of assignment • x ← 3 means the value 3 is written as the new value stored in the memory location labelled x • x ← y means the value stored in the memory location labelled y is copied to the memory location labelled x; in other words, the value stored in the memory location labelled y is read without altering that value and written as the new value stored in the memory location labelled x. Some possible examples to demonstrate solution design are: • finding the average of a set of input numbers • finding largest and smallest numbers in a set of input numbers • calculating the frequency distribution of ranges of numbers in a set of input numbers (e.g. when a series of temperatures T are input, how many are in each of the ranges -20 ≤ T < 0, 0 ≤ T < 20 and 20 ≤ T < 40?) These could be followed by case studies such as an automatic supermarket stock control system for calculating stock levels and automatically re-ordering items. v1 2Y05 Cambridge IGCSE Computer Studies (US) 0441 2 Syllabus ref Learning objectives 3.1.2 Algorithm tools 3.1.3 v1 2Y05 Interpret and test algorithms Suggested teaching activities Learning resources Students need to become familiar with: • top-down design using structure diagrams • program flowcharts to represent algorithms • system flowcharts to represent whole or partial solutions, including hardware • the fact that algorithms can often be re-used as part of the solution of a different problem and that, similarly, libraries of procedure and subroutine program code can also be re-used. LWS coursebook pp. 242–7 Students need to be able to: • work out the purpose of an algorithm using dry runs • choose and use suitable test data for testing: • input validation or other conditional processing (three types: normal, boundary/extreme and abnormal/erroneous) • correctness of a calculation • use trace tables to find the value of variables at each stage in dry run • identify errors in given algorithms and suggest ways of removing these errors. Cambridge IGCSE Computer Studies (US) 0441 www.smartdraw.com/resources/tutorials/#/resources/tutori als/Entity-Structure-Diagrams A tutorial on how to draw structure diagrams using SmartDraw, of which a free, trial version is available http://raptor.martincarlisle.com/ RAPTOR, free program flowchart interpreter software that allows students to draw a flowchart and check its functioning by executing it LWS coursebook pp. 247–51 3