Login or Sign Up to become a member!
LessThanDot Site Logo

LessThanDot

A Technical Community for IT Professionals

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Highly Rated Users

Forum
No Posts Rated

Top 50
Given
Received

Forum Statistics

Users
Members:
1590
Members Online:
6
Guests Online:
6

Total Post History
Posts:
80550
Topics:
18446

7-Day Post History
New Posts:
7
New Topics:
1
Active Topics:
7

Our newest member
langm8029

Other

FAQ
All times are UTC [ DST ]

Google Ads

Puzzle 16: Zip me up, Buttercup

Mind Boggling Puzzles, to keep that grey matter in shape...
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
Please wait...

Puzzle 16: Zip me up, Buttercup

Postby damber on Fri Oct 03, 2008 12:34 pm

OK, after a short break we're back to bring you more puzzle-liscious programming challenges, this time in the form of a compression algorithm. :o

We've all used a compression tool at some point or another, and most probably used a library within our applications to do much of the same. In many cases we probably don't even realise we're using a compression feature.. such as viewing this site, if your browser supports it most of the textual content will be transferred in gzip format.

So what we want to do here is to think about how these algorithms work and write a new handcoded solution from scratch - whilst we don't expect the entry to perform at the same level as existing algorithms, that's not really the challenge - we're looking to stretch those braincells to write something that will compress an input string and decompress to the original exactly - the higher the compression, obviously the better, but just compressing with a noticeable size reduction will be a success.

The rules....

Using the string below, reduce the size of the text in a single transportable file. Then inflate that same file to reproduce the original string exactly (e.g. lossless compression).

You may not use any compression utility, library, etc - this must be your own work.
You may not copy verbatim some existing algorithm to do this either (and changing a function name does not count for being different ;-) ).
You may use the concepts from other compression tools or file formats though
Compressed size in bytes is important and will be the primary metric for judging the winners
Speed of compression will also be considered, but is of lesser importance

Provide your results (with code) in the following format:

Input Size: xxxx Bytes
Input MD5 hash: ......
Compressed size: xxx Bytes
Compression time: xxx ms (or sec, mins, hrs, etc)
Decompressed Size: xxx Bytes
Decompressed MD5 Hash: ......


The Input:

Code is hidden, SHOW


We're going to leave this one open for two weeks so that everyone has chance to have a go.

Also attached as file (suggest using the file for actual test in case the text above is slightly corrupted by the posting process (e.g. removal of whitespace etc)
You do not have the required permissions to view the files attached to this post.
a smile is worth a thousand kind words, so smile, it's easy! :-)


CODE: $5
WORKING CODE: $500
PROPERLY DESIGNED & WORKING CODE: Priceless
User avatar
damber
LTD Admin
LTD Admin
LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660
LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660
 
Posts: 3134
Joined: Tue Oct 09, 2007 1:48 pm
Location: North Wales, UK
Unrated

Re: Puzzle 16: Zip me up, Buttercup

Postby tisodotsk on Sun Oct 19, 2008 7:15 pm

My first result (2 algorithms, in PHP):
  1. Input Size: 23444 Bytes
  2. Input MD5 hash: 9caae65c46aea68c7c5630456d4007cf
  3. ---------------------------------------------------------------------
  4. Compressed size: 21099 Bytes
  5. Compression time: 19.9990272522 ms
  6. Decompressed Size: 23444 Bytes
  7. Decompressed MD5 Hash: 9caae65c46aea68c7c5630456d4007cf
  8. ---------------------------------------------------------------------
  9. Compressed size: 14992 Bytes
  10. Compression time: 2.31652522087 s
  11. Decompressed Size: 23444 Bytes
  12. Decompressed MD5 Hash: 9caae65c46aea68c7c5630456d4007cf
  13. ---------------------------------------------------------------------
I try to improve my English language skills. Most things i do better than this.
tisodotsk
Apprentice
Apprentice
LTD Bronze - Rating: 62LTD Bronze - Rating: 62
 
Posts: 22
Joined: Fri Aug 08, 2008 12:45 pm
Location: Bratislava, Slovakia
Unrated

Re: Puzzle 16: Zip me up, Buttercup

Postby damber on Sun Nov 02, 2008 9:56 pm

congrats tisodtsk in being the only response! - this challenge seems to have been pretty hard to solve.

As this is a programming puzzle, could you post the code that you used to generate those results ?
a smile is worth a thousand kind words, so smile, it's easy! :-)


CODE: $5
WORKING CODE: $500
PROPERLY DESIGNED & WORKING CODE: Priceless
User avatar
damber
LTD Admin
LTD Admin
LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660
LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660
 
Posts: 3134
Joined: Tue Oct 09, 2007 1:48 pm
Location: North Wales, UK
Unrated

Re: Puzzle 16: Zip me up, Buttercup

Postby tisodotsk on Sun Nov 02, 2008 11:09 pm

damber: of course, here it is:
Code is hidden, SHOW
I try to improve my English language skills. Most things i do better than this.
tisodotsk
Apprentice
Apprentice
LTD Bronze - Rating: 62LTD Bronze - Rating: 62
 
Posts: 22
Joined: Fri Aug 08, 2008 12:45 pm
Location: Bratislava, Slovakia

Re: Puzzle 16: Zip me up, Buttercup

Postby damber on Sun Nov 02, 2008 11:22 pm

Nice work tisodotsk, thanks for posting your code :-)

I was a little surprised no-one else attempted it, especially as an example approach was included with the input data ;-)

Therefore I think we can safely declare you the winner ;-)
a smile is worth a thousand kind words, so smile, it's easy! :-)


CODE: $5
WORKING CODE: $500
PROPERLY DESIGNED & WORKING CODE: Priceless
User avatar
damber
LTD Admin
LTD Admin
LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660
LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660LTD Silver - Rating: 660
 
Posts: 3134
Joined: Tue Oct 09, 2007 1:48 pm
Location: North Wales, UK
Unrated