Page 1 of 1

Problem 219

Posted: Sun Nov 30, 2008 3:54 am
by GoSlow2GoFast
I thought I had this figured out, but my answer doesn't check out, so I wonder if I'm missing something. Can anyone confirm if these values would be correct?

C(4)=20
C(5)=27
C(6)=35
C(7)=44
C(8)=54
C(9)=65

~gs2gf

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 7:28 am
by Ikcelaks
C(4) should be computable by hand. Try it.

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 3:23 pm
by GoSlow2GoFast
Yes, agreed. I had done the following to come up with C(4) = 20, am I missing something?

00, 01, 10, 11
4*4 + 4 = 20

~gs2gf

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 3:39 pm
by harryh
Isn't it cheaper to choose:
000, 001, 01, 1 ?
(it only costs 4*3+6=18)

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 4:25 pm
by GoSlow2GoFast
So under that approach, an alternative minimum cost solution to C(6) would be.

00000, 00001, 0001, 001, 01, 1
5*4 + 15 = 35

~gs2gf

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 4:58 pm
by harryh
That's true; no one claims that the solution for minimum cost has to be unique.

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 5:16 pm
by GoSlow2GoFast
But that approach seems to break down for C(8) where starting with "11" rather than "1" yields a minimal cost.

000001, 000000, 00001, 0001, 001, 01, 10, 11
8*4 + 22 = 54

0000000, 0000001, 000001, 00001, 0001, 001, 01, 1
7*4 + 28 = 56

~gs2gf

Re: Problem 219 Skew-cost coding

Posted: Sun Nov 30, 2008 5:33 pm
by harryh
Clearly then, "that approach" does not always produce a minimum cost.

Re: Problem 219 Skew-cost coding

Posted: Mon Dec 01, 2008 2:38 am
by quilan
Hrmm, it's frustrating to have a wonderful algorithm that I can't submit until Monday when I get to work. It looks like it's perfect.

Edit: I'm glad I had a background in compression technologies. Certainly helpful here.

Re: Problem 219

Posted: Fri May 15, 2009 4:53 am
by Assato
I think I'm doing something wrong here... I get the right answer for n = 6 and for n = 8, but a wrong answer for 10^9.

Can anyone confirm my values for:

Cost(1000) = 62054
Cost(10^6) = 1888115810

Thanks a lot.

Edit: Nevermind, found my mistake (and my values were wrong, for future reference). Correct values should be:

Cost(1000) = 21708
Cost(1e6) = 43137383