
Shannon-Fano coding
Shannon-Fano coding is a method used to efficiently compress data by assigning shorter codes to more common symbols and longer codes to less common ones. It begins by listing symbols with their probabilities, then dividing them into groups with roughly equal total probabilities, and assigning binary digits accordingly. This process is repeated for each group until each symbol has a unique code. The result is a prefix code, meaning no code is a prefix of another, which helps to reduce the overall size of the data while ensuring it can be accurately reconstructed.