BÊTACette plateforme est en développement actif ; des bugs, des fonctionnalités manquantes et un risque de perte de données sont possibles. Merci pour ton soutien !

Standard Methods Of A Solution

Apprends en jouant

Réponds à ces questions pour gagner de l'énergie, puis pêche et explore. Sans compte.

Pour les profs : diapos de leçon, notes de révision, schémas prêts à l'emploi pour Standard Methods Of A Solution (Computer Science, CIE) — utilise-les en cours, ou lance le thème en activité de classe interactive que tes élèves jouent en direct.

Notes de leçon

Linear Search

  • A linear search checks every value in a dataset one by one from the start.
  • It works on unsorted data.
  • Algorithm: check first value; if match → stop; else move to next; repeat until found or end.
  • Uses a boolean flag (e.g., `found`) to track if the target is located.
  • In pseudocode, a `FOR` loop iterates through the array; `IF` compares each element to the target.
  • If found, set flag to `TRUE` and output message; after loop, if flag still `FALSE`, output 'not found'.

Bubble Sort

  • A bubble sort repeatedly passes through a list, comparing adjacent pairs and swapping if out of order.
  • Each full pass is called a pass; the algorithm may need multiple passes.
  • After each pass, the largest (or smallest) element 'bubbles' to its correct position at the end.
  • The algorithm stops when a complete pass makes no swaps.
  • In pseudocode, a `WHILE` loop runs while `swaps = TRUE`; inner `FOR` loop compares `nums[y]` and `nums[y+1]`.
  • Swap uses a temporary variable; after each pass, the range decreases by 1.
  • In exams, you only need to show the state after each pass, not every individual swap.

Totalling

  • Totalling accumulates a running total of values as they are input or processed.
  • Initialise total to 0, then in a loop add each value: `Total ← Total + ItemValue`.
  • Example: summing item prices on a receipt.

Counting

  • Counting increments (or decrements) a counter by a fixed amount (usually 1) each iteration.
  • Used to track the number of times an action occurs, e.g., loop iterations.
  • Increment example: `Count ← Count + 1`; decrement: `Count ← Count - 1`.
  • Often used with `DO...UNTIL` or `WHILE` loops to control repetition.

Maximum, Minimum & Average

  • Maximum and minimum find the largest and smallest values in a dataset.
  • In pseudocode, use built-in functions: `Highest ← max(Scores)`, `Lowest ← min(Scores)`.
  • Average (mean) is calculated by summing all values and dividing by the count.
  • Sum via loop: `Total ← Total + Scores[Count]`; then `Average ← Total / LENGTH(Scores)`.
  • These methods are commonly used for grades, scores, or any numeric data.

Linear search through an array checking each element; target 11 not found.

Linear Search ExampleData: [5, 2, 8, 1, 9] Target: 1152819Check 5 → no matchCheck 2 → no matchCheck 8 → no matchCheck 1 → no matchCheck 9 → no matchTarget not found

Bubble sort passes on [5,2,4,1,6,3] showing final sorted order after 4 passes.

Bubble Sort PassesInitial: [5, 2, 4, 1, 6, 3]Pass 1: [2, 4, 1, 5, 3, 6]Pass 2: [2, 1, 4, 3, 5, 6]Pass 3: [1, 2, 3, 4, 5, 6]Pass 4: [1, 2, 3, 4, 5, 6] (no swaps → sorted)123456Sorted list after bubble sort

Illustration of totalling and counting methods.

Totalling & CountingTotalling: Sum of valuesTotal = 0Loop: Total = Total + ItemValueCounting: Increment counterCount = Count + 1Used to track iterations or occurrences.

Diapos

Sign up free to view the lesson slides

Step through every slide for this topic — plus flashcards and revision notes — with a free account.

Questions d'entraînement

Aperçu gratuit — 8 sur 53 questions. Inscris-toi pour toutes les voir.
  1. 1.What is a linear search?

    Easy
    • AAn algorithm that starts at the first value and checks every value one at a time
    • BAn algorithm that divides the dataset in half repeatedly to find a value
    • CAn algorithm that sorts data by comparing adjacent pairs and swapping them
    • DAn algorithm that uses a hash table to locate data quickly
  2. 2.Which of the following is true about a bubble sort?

    Easy
    • AIt compares adjacent values and swaps them if they are in the wrong order
    • BIt selects the smallest value and moves it to the beginning
    • CIt requires the dataset to be already sorted to work
    • DIt only works on numeric data
  3. 3.What does the 'found' variable represent in a linear search algorithm?

    Easy
    • AWhether the target value has been found in the dataset
    • BThe index of the current element being checked
    • CThe total number of comparisons made
    • DThe value of the target being searched for
  4. 4.A linear search is performed on the list [5, 2, 8, 1, 9] to find the value 8. How many comparisons are made before the value is found?

    Easy
    • A3
    • B2
    • C5
    • D4
  5. 5.What is the purpose of the 'swaps' variable in a bubble sort algorithm?

    Easy
    • ATo indicate whether any swaps were made during a pass
    • BTo count the number of passes completed
    • CTo store the temporary value during a swap
    • DTo determine the length of the array
  6. 6.After one pass of a bubble sort on the list [5, 2, 4, 1, 6, 3], what is the order of the list?

    Medium
    • A[2, 4, 1, 5, 3, 6]
    • B[2, 5, 4, 1, 6, 3]
    • C[2, 1, 4, 3, 5, 6]
    • D[1, 2, 3, 4, 5, 6]
  7. 7.Which of the following is a valid advantage of a linear search?

    Easy
    • AIt can be performed on unsorted data
    • BIt is the fastest search algorithm for large datasets
    • CIt uses divide and conquer to reduce search time
    • DIt requires the data to be sorted first
  8. 8.In the context of standard methods of a solution, what is 'totalling'?

    Easy
    • AKeeping a running total of values entered into the algorithm
    • BCounting the number of times a loop iterates
    • CFinding the largest value in a list
    • DSorting a list into ascending order

Unlock all 53 questions & more

Crée un compte gratuit pour voir toutes les questions, les diapos, les cartes mémo et les notes de révision de ce thème.

Annales

Les annales d'entraînement pour ce thème arrivent bientôt.
Bientôt disponible