Unit 2 (Year 12) – Algorithms and Problem Solving

Unit Overview

This unit covers designing algorithmic solutions to various problems.  This unit will also cover programming in all forms.  Areas covered include:
  • Elements of computational thinking
  • Programming techniques
  • Software development methodologies
  • Algorithms
  • Standard algorithms

This unit is studied in Year 12.  If you are studying for the AS level only then there will be the opportunity to sit an exam in the subject at the end of Year 12.  If you are studying for the full A level then the content you covered will be progressed further in Year 13, however you will not sit the examination until Year 13 itself.

Lessons

Weeks 1 and 2 – Thinking ahead (problem solving) (spec 2.1.2)
Week 3 – Introduction to IDEs (spec 2.2.1)
Week 4 – Sequencing (spec 2.2.1)
Weeks 5 and 6 – Logical thinking and branching (spec 2.1.4 and spec 2.2.1)
Weeks 7 to 10 – Iteration (spec 2.2.1)
Week 11 – Recursion (spec 2.2.1)
Week 12 – Thinking procedurally (spec 2.1.3)
Weeks 13 and 14 – Global/local variables, modules, functions, procedures and parameter passing (spec 2.2.1)
Week 15 – Problem solving using computing methods (spec 2.2.2)
Weeks 16 and 17 – Arrays (spec 1.4.2) *
Weeks 18 to 20 – Software development methodologies (spec 1.2.3)
Weeks 21 to 23 – Algorithms and standard algorithms (spec 2.3.1)
Weeks 24 and 25 – Assembly language (spec 1.2.4) *
Weeks 26 to 29 – Databases (spec 1.3.2)
Weeks 30 to 32 – HTML, search engines and server/client side processing (spec 1.3.4) *

(Weeks marked with a * will also carry on during Andrew’s lessons)

Programming tasks and challenges

Make sure you do ALL these challenges, print them out for your folder, and discuss any problems or queries that arise…

  1. Hello world and Data types
  2. Selection and Branching
  3. Selection and Branching part II
  4. Arrays and Recursion
  5. Arrays and Recursion solution
  6. Second Array(List) and Recursion challenge.
  7. Solving hangman, but creating new problems.
  8. Booklet of programming challenges, to be solved with this template.

Guides:

The OCR guide to programming languages.

A very useful guide to pseudocode in the OCR spec.

Weeks 1 to 3 – Abstraction and thinking ahead (problem solving)

Learning Objectives The nature of abstraction. The need for abstraction. The differences between an abstraction and reality. Devise an abstract model for a variety of situations. Identify the inputs and outputs for a given situation. Determine the preconditions for devising a solution to a problem. The need for reusable program components. Learning Outcomes.  You – […]

Introduction to IDEs ( Week 3 )

Learning Objectives The features and uses of IDEs. Compare leading IDEs. Have a look at visual studio. Create a “Hello World” program in visual studio Learning Outcomes.  You – Must understand the purposes and  recognise the main features of an IDE (U/E) Should Create a blank project in visual studio. (D/C) Could write and compile a “Hello world” program.  Begin […]

Data Types and variables – Coding Practice

Coding Practice on Data Types and variables. All these programs MUST be well commented Write a program which stores 4 values in variables adds them up and prints out the result. Amend the above program to print out ” __ + __ +___ +____ is ____”.  This must include the actual variables, concatenated to strings. […]

Selection (Week 4)

Learning Objectives Understand the concept of branching in software design. Look at specific cases where branching is necessary in code. Learn the correct C# syntax for if/then/else Look at the use of a “switch statement” Learning Outcomes Must Have a look at specific software examples of branching,  using a “Fighting Fantasy” analogy, and create simple […]

Branching and selection challenges!

Once more,  print your code out for marking. Make sure it is well commented, especially where things don’t quite work right! Make a “Death Clock”.  Men live an average of 79 years,  women an average of 82.  Ask the user their age and gender,  and cheerfully inform them of just how much time they’ve got […]

Model solution to the three number problem and more challenges

Elegance and redundancy: The smallest of three numbers could be solved two ways…   Coded solution to the smallest number problem:- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace middleNumber {     class Program     {         static void Main(string[] args)         {             int no1, no2, no3, smallest, middle, largest, temp = 0; […]

Iteration (Weeks 7 to 10)

Learning Objectives Understand the need for iteration in code. Write a basic “for” loop. Look at a “do while” loop. Compare with a “while do” loop The best situation for a given loop Learning Outcomes.  You – Must understand the purposes and  recognise the main types of iteration (U/E) Should Solve problems using for and while loops. (D/C) Could Choose […]

Recursion

Learning Objectives Understand the need for and advantages of recursion in code. Use basic recursion to solve simple puzzles. Identify common uses of recursion. Write simple recursive code in c# Learning Outcomes.  You – Must understand the purposes and  recognise the main uses of resursion (U/E) Should solve problems using recursion. (D/C) Could use recursion to write sorting algorithms (B/A) Starter Define the following […]

Arrays and recursion challenge

Using Arrays and Recursion. Please attempt this problem, and print out your results at the end of the lesson.  Make a program which asks user for the number and names of people in the group. The program must add each name to an Array or list object.  Ultimately this array will contain all the names… […]

Arrays and Recursion – Solution 1

Open this text file, and paste the contents into visual studio.   Read through the text, and run the program several times.  Carefully add comments to the code to show how it works. This is not perfect code.  What is wrong with it? One problem is that the code is not properly encapsulated.  The main() […]

Arrays and Recursion – Challenge 2

Challenge 2 Specification: You will create a “hangman” game. The computer will choose from a list of available words, which the player has to guess one letter at a time. Each time the player guesses incorrectly, the computer will draw a small section of a gallows, which increments, on every mistake: ——— ¦     […]

Global/local variables, modules, functions, procedures and parameter passing

Learning Objectives The meaning of variable scope. Global vs local variables. Function or procedure? Parameter passing between functions Learning Outcomes.  You – Must understand the implications of variable scope (U/E) Should pass parameters from one function to another, accessing static values. (D/C) Could understand the implications of scope to good robust code design (B/A) Keywords Words to learn: scope, setter/getter, global,static,local,parameter, […]

Hangman Challenge. One solution – more problems

Here is a fair working solution to the hangman challenge: Run this code, making sure it knows “how to play” Whilst it does indeed work – this is not optimal code. Why?  (Especially concentrate on the main() method). Refactor the code appropriately. How could we test this code against the original spec? Design component tests […]

Software development methodologies

Waterfall Methodology: Waterfall model (systems life cycle) – This process is sequential and goes through the phases of conception, initiation, analysis, design, construction, testing, implementation and maintenance. It was first invented for hardware manufacture, but then was adapted for software development. Click here for a short tutorial. Agile Methodology: Agile methodologies (agile software development) are […]

Web Technologies

You’ll find a wonderful explanation of web-based technologies here: (Search Engine) http://computer.howstuffworks.com/internet/basics/search-engine.htm (Searching through a corpus of text) http://www.google.com/insidesearch/howsearchworks/thestory/index.html Client-side and server-side apps http://www.bbc.co.uk/education/guides/znkqn39/revision/3 Before the exam, you’ll need some practice – http://www.codecademy.com/ is the ideal place for this. These exercises will give you a good working knowledge of the basics: HTML Codecademy lessons CSS Codecademy lessons […]

Assembly Language

Assembly language is a low level programming language. This means that it provides very close control of the CPU. However, assembly language, being a low level language, is hard to understand, and programmers need to have a good understanding of the way the CPU works, such as the fetch decode execute cycle. The Little Man […]

Thinking in Methods

Computational Methods Eating a biscuit Create a divide and conquer diagram (top down design) for eating a biscuit (The biscuits are in the kitchen, in a sealed packet in a cupboard that is too high for you to reach) Here are general descriptions for the task. http://ocw.mit.edu/resources/res-tll-004-stem-concept-videos-fall-2013/videos/problemsolving/basic-programming-techniques/ http://www.cs.iit.edu/~cs100/ProblemSolving.pdf Features that make a problem solvable by […]