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 count the frequency of each character in the string and write them in a table sorted alphabetically. For example, the character 'O' has the lowest frequency in this string. Then, I would take the two characters with the largest frequencies and combine them into a new parent node. The frequency of this new parent node is calculated by multiplying the two frequencies together. I would then repeat this process with the remaining nodes until the entire tree is built."
State four mistakes the student has made in her response.
Practise AQA GCSE Computer Science Data compression with exam-style questions for GCSE Computer Science. 60 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.