Ad
  • Custom User Avatar

    Approved. Just make sure to modify the description accordingly

  • Default User Avatar
  • Custom User Avatar

    a) serialize coding table calculated,

    Meaning what exactly?

    b) encode message;

    ?

    So, there are 4 methods in kata api, and 2-a), 3) are not the same as haskell variant.

    Why? Can you provide some examples because I cannot follow your description.

    I think, it's more clear how to work with code table, then just 'decode a bit sequence using the given frequencies' (haskell kata description).

    I think it is part of the fun to figure out how to best do something. Also that's the comment on the decode function and not the description. The description goes into detail and explains the basic concepts.

    When "usually we choose 0 for the left branch and 1 for the right branch", shouldn't be b:11, c:01 if a:0?

    No, it should not. The description is consistent, please read again.

    a=0 and freq(a)=4 > freq(b+c)=3; so last code letter for c should be the same as first for a, because of freq(c)=2 > freq(b)=1 (in accordance with select branch rule.

    freq(b+c)=3 meaning what? Define first.

  • Default User Avatar

    Concerning the last comment, the final codes depend on the way you build your tree. For example, in the situation of the example, here is a valid tree
    ..*
    ./.\
    a...*
    .../.\
    ..b...c
    which will give a:0, b:10, c:11. Otherwise, you can exchange b and c on the tree (and get a:0, b:11, c:10) and a and the node (and get a:1, b:01, c:00 or a:1, b:00, c:01).

    What you won't get is something as you suggest with a:0 and c:01. Thing is the left-most digit is how you go from the root to the first nodes and a is in another component than b and c (because as they have the 2 smallest frequencies, b and c are paired).

  • Default User Avatar

    Sorry. Given that there was no spoiler button I thought I was corresponding with the author only. Confusing UI. Is there any way I can exchange ideas with the author only?

  • Custom User Avatar

    @ecolban, don't quote code in comments under translations, it is visible to everyone.