For this week's homework, we had to implement a compression algorithm that doesn't compress all the input at once, but to make the compression in parts. That's the adaptive part of the coding.
This is how I implement it: For each part of the input that was going to be processed, take the input letters and make a dictionary with each letter as key, and its frequency as value. Next, a new dictionary is created, but this time the value is going to be its probability of apearing in the spanish alphabet. Also, for each part we had to see if the some letter hasn't appear before.
With this, we create a graph where each node is added by "asking": is it greater than the actual node? (go to right); is it lower than the actual node? (go to left).
This is what I did:
El resultado se cicla :(