Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
You can change this under Settings & Account at any time.
A Level Computing-Recursion
Transcript of A Level Computing-Recursion
Not in pseudo-code. You need to be able to write code in a lanaguage of your choice.
Understanding and ability in a subject requires Effort, you need solid foundations... Write code!
You must practise coding to
understand principles and get
experience and confidence for
questions like this.
Use pseudo-code from
Start with simple examples and
build up.. Computing Before you try and do anything..
WHAT is it I am trying to acheive?
Be clear about your objectives..
otherwise you won't know whether
you have met your target. Use debugging tools to learn HOW the code works.
This function is recursive and in A2 Computing you will learn about "stacks", the data structure
that the computer needs to use to keep track of the execution of programs.
Using concept maps to link knowledge to bring the subject together, using prezi, to create them! Learn how to... Recursion What is Recursion? A function defined in terms of itself, in other words the function calls itself. During the execution of recursive code
there is clearly repetition..
Recursion and repetition can achieve
the same result, but are conceptually quite different Where do I start? Think about this Question... The task is to rewrite this algorithm, written with repetition.
But use recursion NOT repetition/Iteration This Question (Q4) was on OCR's F452 June 2011 A previous part of the question requires
a trace-table (Dry-run) to be completed.
This will help give an overview
of HOW the code works. How to create a trace-table Now the Trace Table is complete, work through it to understand how the code works...
Read the question stem to get information... Take more time to create a detailed trace table for every line of the algorithm or code.
Notice, the exam paper has fewer rows than the working.. Foundations practise coding trace algorithms visit codeHS.com Programming is hard but don't give up, stick with it.
You get a great sense of achievement and it gives you valuable logic and problem-solving skills.
See the "Not all schools teach programming" YouTube video Don't give up, just because you find something hard to do once you know how to create a trace table you can use it
to help understand how the code works. create a trace table How can I get better
at Programming? Practice coding all 3
programming constructs Use resources to help you learn.
People, Books, YouTube, etc
ALWAYS Review what you have
learnt and check you understand Use "Top-Down Design" Write code, put algorithms
from questions into real code.
This will help you:
*learn how to use the software Think about how the
3 constructs can be used:
*Repetition Create algorithms to
break the task/scenario
down. Sequence Selection
IF & Case/Select Repetition or Iteration
Logic controlled WHILE
Logic controlled UNTIL CodeHS.com is an excellent
website that will teach
you how to code YouTube is quick to search
and someone, somewhere
has probably created a video
for what you want.. Ask friends, teachers to
explain things you don't
understand. Break problems down into smaller manageable chunks
This itself is a recursive way of working! Use a trace table to understand
how the function works Create a new function
using the principles
you have learnt How to code the Iterative version of the function.
Using the pseudo-code from the original question Learn by using debugging tools Here it is, how to create a recursive function.... 4. THINK about how you can change a repetition structure to a recursive one 1. Read the question 2. Work through the code 3. Complete a trace table 5. do it, write the code 3.2.1 d. explain the advantages of designing a solution to a problem by splitting it up into smaller problems (top-down/modular design); 3.2.1 Designing solutions to problems 3.2.2 The structure of procedural programs 3.2.3 Data types and data structures 3.2.4 Common facilities of procedural languages 3.2.5 Writing maintainable programs 3.2.6 Testing and running a solution The F452 Specification has 6 sections, - my own reference numbering, used in my teaching resources 3.2.1 h. describe the steps of an algorithm using pseudo-code; 3.2.1i. understand, and implement algorithms and evaluate them by commenting on their efficiency, correctness and appropriateness for the problem to be solved; reading text books... Using trace tables to understand how a function works...
... and from there gain a better understanding of recursion
... by writing a recursive function ....
...and see how it works compared with an iterative solution Learnt from mistakes Be proactive Thinking about this ONE exam question...
which topics have we covered? Use Specification
as a check list What have I learn't from this? knowledge you will have gained, deepened your understanding, and improved your practical coding skills... But there is far more under the surface... Anything you do wrong is something you can learn from, especially true in practical computing Don't just read *Make notes,
*create concept maps
*work through questions Have I covered everything? CREATE concept maps to show relationships between concepts and knowledge. 3.2.2b. identify the three basic programming constructs used to control the flow of execution, ie sequence, selection and iteration; 3.2.2c. understand and use selection in pseudo-code and a procedural programming language 3.2.2d understand and use iteration in pseudo-code and a procedural programming language 3.2.2f. understand, create and use subroutines (procedures and functions), including the passing of parameters and the appropriate use of the return value of functions 3.2.2g. identify and use recursion to solve problems; show an understanding of the structure of a recursive subroutine, including the necessity of a stopping condition; 3.2.2h. trace the execution of a recursive subroutine including calls to itself; 3.2.3a. define different data types, eg numeric (integer, real), Boolean, character and string; select and use them appropriately in their solutions to problems; This question need not require or cover much of this section...Make sure you work through practical tasks that do ! 3.2.4a. understand and use assignment statements; You could easily extend the project so that there is some validation on data input.
This question need not require or cover much of this section...Make sure you work through practical tasks that do ! 3.2.5 a. define, understand and use the following terms correctly as they apply to programming: variable, constant, identifier, reserved word/keyword; 3.2.5c. declare variables and constants, understanding the effect of scope and issues concerning the choice of identifier (including the need to avoid reserved words/keywords); 3.2.5g. create appropriately modularised programs (following a top-down/modular design as produced in 3.2.1: Designing solutions to problems) making effective use of subroutines to improve maintainability; 3.2.5i. use indentation and formatting to show clearly the control structures within the code. 3.2.6e. perform a dry run on a given algorithm, using a trace table; 3.2.6f. describe the use of a range of debugging tools and facilities available in procedural programming languages including translator diagnostics, break points, stepping, and variable checks; 17 topics! Before you can be confident in completing questions like this, you must get practical coding experience, use something like codeHS Write Code in class and at home.
Try and code algorithms given in exam questions.
Take the cover off your home computer and look inside! Needed to answer examination questions
One of the MOST IMPORTANT things is to make sure you use the correct terminology and write in good English, clearly and concisely. practical
gives you practice with both aspects of the course AND tests your understanding. Work through Past Papers and code whenever you can This presentation is based on just ONE Past paper question. Asking you to re-write a given iterative function using Recursion What is recursion? Thinking about HOW the code works... Test yourself.... If you put in the time and effort... working with others (helping and being helped) If you spend time... using online resources (tutorials, videos, Q/A forums, learning new software) making notes writing code asking questions