You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson covers pattern recognition, one of the four key components of computational thinking as required by OCR J277 Section 2.1. Pattern recognition helps us solve problems more efficiently by identifying similarities between problems and reusing existing solutions.
Pattern recognition is the process of identifying similarities, trends, or recurring elements within and between problems. By recognising patterns, we can:
| Situation | Pattern Recognised |
|---|---|
| Weather forecasting | Temperature and weather follow seasonal patterns — summer is typically warmer than winter |
| Traffic | Roads are busiest at the same times each day (rush hour) |
| Music | Songs follow patterns — verse, chorus, verse, chorus, bridge, chorus |
| Language | Grammar follows patterns — most English verbs add "-ed" for past tense |
| Shopping | Sales patterns — shops have sales at predictable times (Black Friday, January sales) |
In computer science, pattern recognition is used to:
When decomposing multiple problems, you may notice that some sub-problems appear repeatedly.
Example: Building a quiz app and a flashcard app
| Quiz App Sub-Problems | Flashcard App Sub-Problems |
|---|---|
| Load questions from file | Load cards from file |
| Display question to user | Display card to user |
| Get user input | Get user input |
| Check answer | Check answer (flip card) |
| Track score | Track progress |
| Show results | Show summary |
Pattern recognised: Both apps need to load data, display items, get input, and track progress. A reusable module could handle these common tasks.
Many problems require similar algorithmic approaches:
| Pattern | Description | Where It Appears |
|---|---|---|
| Searching | Looking for a specific item in a collection | Finding a book in a library, searching a contact list |
| Sorting | Arranging items in a specific order | Alphabetical lists, leaderboards, search results |
| Counting | Tallying items that meet a condition | Counting votes, attendance tracking |
| Accumulating | Adding up a running total | Calculating total cost, averaging scores |
| Filtering | Selecting items that match criteria | Spam filters, age verification |
OCR Exam Tip: When the exam asks you to identify patterns, look for sub-problems that appear in multiple parts of the problem or that are similar to problems you have solved before. State clearly what the common element is and how recognising it helps (e.g. "the sorting algorithm used for the leaderboard can be reused for the results table").
Once a pattern is recognised, the solution can be generalised — adapted to work for a range of similar problems rather than just one specific case.
Specific problem: Calculate the average of 5 test scores. Generalised solution: Calculate the average of any number of values.
Specific version:
total = score1 + score2 + score3 + score4 + score5
average = total / 5
Generalised version:
total = 0
FOR i = 1 TO n
INPUT score
total = total + score
NEXT i
average = total / n
The generalised version works for any number of scores, not just 5. This is more useful and reusable.
Recognising patterns leads to code reuse, which has several benefits:
| Benefit | Explanation |
|---|---|
| Saves time | Do not need to write the same code twice |
| Reduces errors | Tested code that works correctly can be reused with confidence |
| Improves consistency | The same logic is applied in the same way everywhere |
| Easier maintenance | Fix a bug once, and it is fixed everywhere the code is used |
| Mechanism | Description |
|---|---|
| Functions/procedures | Write once, call many times |
| Libraries | Pre-written collections of functions (e.g. math library) |
| Modules | Self-contained units of code that can be imported |
| Templates | Starter code that can be adapted for different purposes |
Pattern recognition also applies to analysing data:
| Data Pattern | Example |
|---|---|
| Trends | Sales increasing over time |
| Cycles | Website traffic peaking at the same time each day |
| Anomalies | An unusual spike in login attempts (could indicate an attack) |
| Correlations | Students who attend more lessons tend to get higher grades |
| Classifications | Emails can be classified as spam or not-spam based on patterns in the content |
Modern machine learning systems are designed to automatically recognise patterns in large datasets. For example:
While you do not need detailed machine learning knowledge for GCSE, understanding that computers can be trained to recognise patterns is useful context.
A school needs three different systems:
Patterns identified: All three systems need to:
Benefit of recognising this pattern: A single, generalised loan management system can be designed that works for books, equipment, and laptops. This saves development time, ensures consistency, and makes maintenance easier.
OCR Exam Tip: Pattern recognition questions often ask you to identify what is similar between two or more problems. Clearly state the common elements and explain how recognising the pattern leads to a more efficient solution (e.g. code reuse, generalisation).
Pattern recognition is the process of identifying similarities within and between problems. Recognising patterns allows us to generalise solutions, reuse code, and solve new problems more efficiently. In computing, common patterns include searching, sorting, counting, and filtering. For the OCR J277 exam, practise identifying patterns in given scenarios and explaining how they can be used to create more efficient and reusable solutions.
Scenario: A secondary school runs three separate booking processes. Parents' evenings are booked by parents through a web portal. After-school clubs are booked by students through a tablet in the library. Sports fixtures are booked by PE staff through an internal spreadsheet. All three are currently standalone systems, and the school wants to combine them. Use pattern recognition to design a unified booking system.
Step 1 — List the problems side by side.
| Feature | Parents' Evening | After-School Club | Sports Fixture |
|---|---|---|---|
| Who books | Parent | Student | Staff |
| What is booked | Appointment slot | Club place | Team slot |
| When | Specific time on a specific date | Recurring weekly slot | One-off date |
| Capacity | 1 per slot | Up to 20 per club | Team size (e.g. 11) |
| Confirmation | Email to parent | Printed slip | Entry on PE noticeboard |
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.