compression.run_length_encoding¶
Functions¶
|
Performs Run Length Decoding |
|
Performs Run Length Encoding |
Module Contents¶
- compression.run_length_encoding.run_length_decode(encoded: list) str ¶
Performs Run Length Decoding >>> run_length_decode([(‘A’, 4), (‘B’, 3), (‘C’, 2), (‘D’, 1), (‘A’, 2)]) ‘AAAABBBCCDAA’ >>> run_length_decode([(‘A’, 1)]) ‘A’ >>> run_length_decode([(‘A’, 2)]) ‘AA’ >>> run_length_decode([(‘A’, 3), (‘D’, 6), (‘F’, 3), (‘C’, 3), (‘A’, 2), (‘V’, 4)]) ‘AAADDDDDDFFFCCCAAVVVV’
- compression.run_length_encoding.run_length_encode(text: str) list ¶
Performs Run Length Encoding >>> run_length_encode(“AAAABBBCCDAA”) [(‘A’, 4), (‘B’, 3), (‘C’, 2), (‘D’, 1), (‘A’, 2)] >>> run_length_encode(“A”) [(‘A’, 1)] >>> run_length_encode(“AA”) [(‘A’, 2)] >>> run_length_encode(“AAADDDDDDFFFCCCAAVVVV”) [(‘A’, 3), (‘D’, 6), (‘F’, 3), (‘C’, 3), (‘A’, 2), (‘V’, 4)]