Find how much something as reduced by in %

318 Views Asked by At

I'm using Huffman encoding to perform an encoding on a string, soon I'll move it be used on compressing images.

I've got the length of the string: x
I've got the length of the encode string: y

I want to know in a percentage how much smaller y is than x. So I can say I've shrunk the input string by %

I'm probably making it harder than it actually is in my head, which is why I got a mind block.

How do you work that? I presume its really really easy! Simple maths is always the hardest :P

1

There are 1 best solutions below

1
On BEST ANSWER

The input string is shrunk by $$\frac{x-y}{x}\times 100$$ percent.