The task of compression consists of two components, an encoding algorithm that takes a file and generates a “compressed” representation (hopefully with fewer bits), and…