Skip to content

Course home

Data compression

Data compression

EasyMedium
12345678910111213
Question 2

A student was asked to describe how a Huffman tree could be created for the string in Figure 1.

Figure 1

COCOA COCONUT

Her response was:

"I would first write down the frequency of each character in the string and sort the list in alphabetical order. For example, the character 'C' has the lowest frequency in this string. Then, to construct the tree, I would select the two nodes with the lowest frequencies and combine them into a parent node. The frequency of this parent node is calculated as the product of the two children's frequencies. I would then repeat this process by always combining the newly created parent node with the next lowest single-character node until the tree is complete."

State four mistakes the student has made in her response.

[4]
Markscheme

Data compression Questions

  1. GCSE
  2. /Computer Science
  3. /Data compression

37 exam-style questions on AQA GCSE Computer Science Data compression. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank