HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Notes
  2. /Standard Algorithms and Validation: Quick Revision
Computer Science

Standard Algorithms and Validation: Quick Revision

A brief note on standard algorithms and validation: totalling, counting, maximum, minimum and average, linear search, bubble sort, and the validation and verification checks, with practice, a program and questions to check yourself.

StemPy LabWritten by StemPy Lab
Log in to save

A brief note on Standard Algorithms and Validation. Read it before a test. Try each question at the end before you open its answer.

The standard methods

  • Totalling: Total ← 0 before the loop; Total ← Total + Value inside.
  • Counting: Count ← 0 before the loop; Count ← Count + 1 inside, often inside an IF.
  • Maximum and minimum: start with the first value (or a value beyond every possible one); replace it with any larger (or smaller) value.
  • Average: Total / Count, once, after the loop.

Searching and sorting

  • Linear search: compare each item in turn from the first; stop at a match or at the end. It works on any list.
  • Bubble sort: compare neighbours; swap if out of order; one pass puts the largest value at the end; repeat until a pass makes no swaps.
  • A swap needs a temporary variable: Temp ← A, A ← B, B ← Temp.
  • For nnn items a pass makes at most n−1n - 1n−1 comparisons.

Checking input

  • Validation (is it sensible?): range, length, type, presence, format, check digit.
  • Verification (was it entered as intended?): visual check, double entry check.
  • A validation loop repeats the input with a message until the data is acceptable.

Practice with new numbers

A program to try

The program totals six race times, counts the times under 606060 seconds and finds the fastest, starting with the first value.

Read it first. Then run it. Which line would you change to find the slowest time?

1. Add a seventh time of 55. Predict the three results before you run it.

Mistakes to avoid

  • Resetting a total or a count inside the loop.
  • Starting a maximum at 000 when the values can be negative.
  • A swap without Temp.
  • Calling a double entry check validation. It is verification.

Check yourself

  1. The inputs are 333, 111111, 666 and 888. What are the total, the count of values over 555, and the average?
  1. A list of 121212 names does not contain the name you want. A linear search runs through it. How many comparisons does it make?
  1. A password must have at least 101010 characters. Which check is this?
  1. Sort 3,1,23, 1, 23,1,2 with one sweep of neighbour swaps. What do you get?

Sources

  • Cambridge International, IGCSE Computer Science 0478 syllabus (2026, 2027 and 2028), unit 7, parts 4 and 5.
← All Notes
← Pseudocode, Trace Tables and Testing: Quick RevisionVariables, Selection and Loops: Quick Revision →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

On this page

  1. The standard methods
  2. Searching and sorting
  3. Checking input
  4. Practice with new numbers
  5. A program to try
  6. Mistakes to avoid
  7. Check yourself
  8. Sources

Goes with the lesson

  1. Validation and verificationStandard Algorithms: Totals, Searching, Sorting and Validation

More notes on this topic

  1. Pseudocode, Trace Tables and Testing: Quick Revision
  2. Planning a Program: Quick Revision
  3. Logic Circuits and Truth Tables: Quick Revision
  4. NAND, NOR and XOR Gates: Quick Revision
  5. NOT, AND and OR Gates: Quick Revision
All notes on this topic →