AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Represent data in RLE frequency/data pairs. Students could be given a…

    Full specification wording

    Data compression: Represent data in RLE frequency/data pairs. Students could be given a bitmap representation and they would be expected to show the frequency and value pairs for each row,

    To encode a bitmap with RLE, work along each row from left to right.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 12 of 13

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    To encode a bitmap with RLE, work along each row from left to right. Count how many identical pixels occur in a run, write that count, then write the pixel value, and repeat for the next run until the row ends. For example, a row of five white then three black pixels becomes 5/white then 3/black. Do this separately for every row, because runs do not carry across a row boundary. The result is a list of frequency/data pairs per row that can be decoded back to the original bitmap exactly. Learners should practise reading a grid of pixels and producing the pairs, keeping the count and value in the correct order and starting a new count whenever the value changes.

    What earns the marks

    • Work along each row from left to right, grouping consecutive identical pixel values into runs.
    • For each run, record the frequency (number of identical pixels) followed by the data value (the pixel colour).
    • Start a new pair whenever the pixel value changes, so each pair covers one uninterrupted run.
    • Treat each row separately; a run does not continue from the end of one row into the start of the next.
    • The pairs must reconstruct the original bitmap exactly when decoded, confirming the encoding is correct.

    Common mistakes and how to put them right

    • Continuing a run across a row boundary.

      Put it right: Each row is encoded separately, so a run ends at the end of the row.

    • Reversing the order and writing the value before the count.

      Put it right: Write the frequency first, then the value, for example 5/white.

    • Merging two different colours into one pair.

      Put it right: A new pair begins whenever the pixel value changes.

    Exam tips

    • Count carefully along each row and double-check the total of all frequencies equals the number of pixels in that row.
    • Keep the same order throughout (frequency then value) so the encoding is consistent and decodable.
    • When checking your answer, decode your pairs back into pixels to confirm they match the original bitmap.

    Try the lesson

    The start of the Data compression: Represent data in RLE frequency/data pairs. Students could be given a bitmap representation and they would be expected to show the frequency and value pairs for each row, lesson, made from checked teaching notes for this specification point.

    Have a go first

    A single row of a black-and-white bitmap is 11110000. Using run length encoding, which frequency/data pair represents this row?

    There is more to this lesson

    The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

    Carry on with the full lesson

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Test your understanding of Data compression: Represent data in RLE frequency/data pairs. Students could be given a bitmap representation and they would be expected to show the frequency and value pairs for each row,

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge