Introduction to Huffman Coding
Huffman coding is a lossless compression method. Symbols that appear often get shorter binary codes; rare symbols get longer codes.
Question Type: fill in the blanks
{"paragraph": "Audit trails help find [[vulnerabilities]] by showing unusual [[actions]], such as repeated failed logins."}
{"paragraph": "Audit trails help find [[vulnerabilities]] by showing unusual [[actions]], such as repeated failed logins."}
Building a Huffman Tree
A Huffman tree is built by repeatedly joining the two least frequent nodes. Walking left/right to a leaf gives that symbol's code.
No code is a prefix of another, so the bitstream can be decoded uniquely.
Huffman Tree Visualisation
Question Type: short answer
{"answer": "Who did the action, what they did, when, or whether it succeeded.", "rubric": {"0": "Incorrect or no response", "1": "Partial credit", "2": "Who did the action, what they did, when, or whether it succeeded."}, "question": "Give one piece of information an audit trail should store."}
{"answer": "Who did the action, what they did, when, or whether it succeeded.", "rubric": {"0": "Incorrect or no response", "1": "Partial credit", "2": "Who did the action, what they did, when, or whether it succeeded."}, "question": "Give one piece of information an audit trail should store."}
When It Helps
Huffman is used inside formats such as ZIP and JPEG (for some stages). It works best when frequencies are uneven. If every symbol is equally likely, little is saved.
A code review inspects
{"answers": {"A": "Source code for bugs and insecure patterns", "B": "Only the colour scheme of the IDE", "C": "Network cables in the server room", "D": "CPU clock speed during the fetch cycle"}, "question_text": "A code review inspects", "correct_answer": "A"}
A [[code review]] reads the source. An [[audit trail]] reads logged events after the program has run.
{"cloze_text": "A [[code review]] reads the source. An [[audit trail]] reads logged events after the program has run."}
{"keyword": "code review", "definition": "A structured inspection of source code to find bugs, vulnerabilities and unclear design"}
Question Type: fill in the blanks
{"paragraph": "Reviewers look for missing [[validation]] and insecure storage of [[passwords]] before release."}
{"paragraph": "Reviewers look for missing [[validation]] and insecure storage of [[passwords]] before release."}
Complete! Ready to test your knowledge?
Huffman coding
- Introduction to Huffman Coding
- Building a Huffman Tree
- Huffman Tree Visualisation
- When It Helps