Git Product home page Git Product logo

compression_tech_test's Introduction

Compression Tech Test

You are given this text in bible.txt, in which is a copy of The Bishops' Bible, an old English bible, processed by optical character recognition software.

Your task is to create two programs, a compressor which produces a compressed file, and a decompressor which, given the compressed file, produces the original file again.

Your challenge is to make the sum of the size of bible_compressed.txt and decompress as small as possible.

$ ./compress bible.txt > bible_compressed.txt
$ ./decompress bible_compressed.txt > bible_original.txt

$ md5 bible.txt
MD5 (bible.txt) = 833640dfb9cb25e2ac0ae3f4496331f7

$ md5 bible_original.txt
MD5 (bible_original.txt) = 833640dfb9cb25e2ac0ae3f4496331f7

# The two hashes are the same

$ ls -l bible_compressed.txt decompress
-rw-r--r--@ 1 kay  staff  181266 13 Aug 15:55 bible_compressed.txt
-rwxr-xr-x  1 kay  staff      71 13 Aug 15:55 decompress

# The smaller the sum is  ^^^^^^ the better.
# In this case it is 181,266 + 71 = 181,337
# (The original is 181,486, so this is a saving of 149 bytes)

I have included a simple version of compress and decompress to get you started.

No external compression libraries allowed, of course.

Bonus

Runtimes (e.g. the Ruby interpreter) are quite large. Write decompress to have no external dependencies. You may wish to consider using a compiled language like C.

Then you can sum the size of bible_compressed.txt and decompress and have genuine compression going on! What a lovely feeling!

compression_tech_test's People

Contributors

neoeno avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.