Download presentation
Presentation is loading. Please wait.
Published byAlexina Benson Modified over 8 years ago
1
Algorithms and Pseudocode
2
What is an algorithm? An algorithm is a description of a process independent of any programming language. e.g. An algorithm to find side a of right angled triangle given sides b and c Input b, c Calculate Square root of b squared plus c squared Output result
3
What is Pseudocode? Pseudo code is an informal, high-level description of an algorithm. This resembles a programming language but it uses less strict syntax and is independent of any real programming language. e.g. An algorithm to find side a of right angled triangle given sides b and c Input b, c a ← Sqrt(b*b + c*c) Output a
4
Task 1 - Structured English Algorithm Using the cards provided construct the algorithm to find the largest of the three numbers A, B and C.
5
Solution Logic Firstly, Number A is compared with Number B. If Number A is the largest, then LargestNumber takes on the value of Number A. If Number B is the largest, then LargestNumber Takes on the value of Number B. Then LargestNumber is compared to Number C. If Number C is larger then LargestNumber becomes Number C. Otherwise LargestNumber stays as it is.
6
Solution IF Number A > Number B THEN SET LargestNumber TO Number A ELSE SET LargestNumber TO Number B IF Number C > Largest Number THEN SET Largest Number TO Number C OUTPUT LargestNumber
7
StructureStructured English example Pseudocode example AssignmentMULTIPLY Number1 BY Number2 TO GET Product Product ← Number1 * Number2 SelectionIF score > 70 THEN SET Grade TO Merit If score > 70 Then grade merit” End If IterationREPEAT UNTIL X = 10 Input Number Add Number to X Repeat Input Number X X + Number Until X = 10 Structured English v Pseudocode
8
Task 2 – Garden Fence Algorithm Download and complete the Garden Fence algorithm worksheet on the A2 Computing homepage. Complete by next lesson…
9
Garden Fence Algorithm Solution Input gardenLength Input gardenWidth Input fenceWidth areaToFence (gardenLength * 2) + gardenWidth numFencePanels (areaToFence div fenceW) + 1 Output numFencePanels
10
Input paintArea PaintAreaNeeded numFencePanels * fenceH * 2 NumTinsNeeded (paintAreaNeeded div paintArea) + 1 Output numTinsNeeded Garden Fence Algorithm Extension
11
Resources Chapter 1.4 Algorithm Design – AS Computing by Bond and Langfield See pages 23, 24 and 25 in book
12
Principal Moderator’s Report Very few candidates gave clear algorithms relating to the data transformation to be programmed by the candidate. These algorithms should be in a form that could be coded in any language and need to concentrate on the complex parts of the system that the candidate is going to code. Frequently, the ‘sample’ was of very basic functions. We are not very interested in the algorithms required for login, form navigation and password changes etc. Algorithms in pseudocode or structured English must be given if a high mark is to be scored. Frequently ‘algorithms’ were post implementation code extracted from the full code listing, not in pseudocode or structured English as required. The algorithms presented in this section are one of the places that Moderators inspect closely at an early stage to confirm the potential level of complexity of the project. It is not appropriate to omit design algorithms and forward reference those given in the System Maintenance section because the purpose of the Design section is to allow a competent third party to implement the required system. Candidates were penalised heavily for doing this because the design is simply not feasible without design algorithms.
13
Exemplar Algorithms Project 4 pages 23 to 26 Project 7 pages 32 to 37 Project 9 pages 47 to 52
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.