Skip to content

Concerning the "A question of character" posting on your site - prefix codes? #30

@joha2

Description

@joha2

Hey @paulfitz and @aw1231 long time no hear! I hope you're doing well!

In the wiki I already asked this question, but to my knowledge we never discussed this:

Is it possible to use prefix codes for the "words" introduced by intro?

https://www.cs.princeton.edu/courses/archive/spr01/cs126/assignments/prefix.html

https://en.wikipedia.org/wiki/Prefix_code

This should simplify the decoding, since no "word" is prefix of another "word". I would also suggest to use this for the binary numbers, such that they also get unique codes. At the end the recipient does not care whether in the message the binary one is writen as 1 or another combination. Or one could start the tree for the prefix with 0 and 1 (but this does not mean 1 will stay 1). See the tree in the attached image, where 0 would be 0, but 1 would be 10 and unary would be 110 (depending whether you go left or right seen from the root node).
At the end this would mitigate issues like + being 10 something which is not searchable in the message. OK, at the end the shorter codes can appear within the longer ones, so maybe a simple search is not useful. But if you get the bytestream byte by byte every command is unique 😄 Is this an option?

Best wishes
Johannes

tree_proposal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions