On the Subject of Huffman Coding
When every bit counts… literally.
- The module displays the probabilities (in percent) of six symbols in a discrete, memoryless system, with random values ranging from 1 to 100 inclusive.
- The module also has a percentage display, where each digit can be incremented or decremented, and a "Submit" button.
- To disarm the module, submit the coding efficiency (in percent), rounded to two decimal places, at the right time, when Huffman coding is applied to these symbols.
Note: For the purposes of calculation in Steps 1-2, treat the probabilities as numbers themselves and not as percentages.
For the purposes of calculation in the succeeding steps, treat the probabilities as percentages. Converting them to decimals would simplify calculations.
Step 1: Edgework-Based Adjustments to Initial Probabilities
Use the reading order to determine the position of the probability of a symbol, starting the count with the first and ending at the sixth.
- Take the serial number and convert all letters to their numeric position in the alphabet (A = 1, B = 2, etc.).
- Then, add the value of the (first/second/.../sixth) character of the serial number, in reading order, to the probability of the (first/second/.../sixth) symbol.
Afterwards, apply the following rules in succession. Use the modified probabilities from the previous step as the new values for the next step.
- If there are more letters than digits in the serial number, multiply the probabilities of the odd-positioned symbols by 5.
- Otherwise, multiply the probabilities of the even-positioned symbols by 5.
- If there are more ports than batteries, add 10 to all even-positioned probabilities.
- Otherwise, add 10 to all odd-positioned probabilities.
- If the serial number contains at least one letter in the word "HUFFMAN", add the digital root of the highest probability to all probabilities.
- Otherwise, add the digital root of the current lowest probability to all probabilities.