ScratchData LogoScratchData
Back to GreenScripter's profile

Huffman Coding Usernames

GRGreenScripter•Created May 16, 2021
Huffman Coding Usernames
28
23
432 views
View on Scratch

Description

Huffman Coding applied to convert scratch usernames to a single base 10 number and back. While Arithmetic coding is better in general at compression, there are some limitations imposed by scratch, especially on the speed. Huffman coding is much faster to run and is generally only slightly worse, which should be hard to tell at all for messages this short. Note that the binary to and from decimal conversion here is not a direct change of base, but is instead designed to be very fast using a 52 bit block encoding with 1 bit headers. This method still has the downside of that it may generate longer outputs than other methods for random inputs but should be shorter for almost every real world input. This may output shorter a number than the arithmetic coding version for a given input. This happens because I was not able to get my version of arithmetic coding to work without a length field, for extremely long inputs the benefits of arithmetic coding would outweigh those 2 digits extra, but scratch is too slow to take advantage of that.

Project Details

Project ID531084657
CreatedMay 16, 2021
Last ModifiedMay 4, 2024
SharedMay 16, 2021
Visibilityvisible
CommentsAllowed