Akash
Akash

Reputation: 29

Run length encoding with dynamic blocks of string?

I want to write a dynamic block size run length encoder but i am unable decide how should I implement it in python with dynamic blocks (substring length depending on content )
For example i have a string : 1110011100001


A human can easily tell that string 11100 is repeating consecutively. Block size is 5 in above case. But I want the program to decide the optimal block size which is repeating consecutively and this block size may change as we further encounter new substrings.
One solution is to brute force every combination of substring and match it with all substring. Is there any other optimal solution.

Writing RLE compressor but runtime is higher and implementation is a bit complex.

Upvotes: 2

Views: 56

Answers (0)

Related Questions