Code Comments
Programming Forum and web based access to our favorite programming groups.I have a coding question: I have an algorithm were I have coded for two events. The first event may have zero or more bits. The second will have one or more bits. It is necessary to delimit each event. I have coded this way: For the first event I use zeros and for the second I use ones terminated by a zero. " 1011110000001000000011111000010 " A first event will not follow a first event but, a second event may follow a second event. My Question is: Is there a better coding? Can I avoid the need for a termination bit in the second event and still be able to have "back to back" delimited second events? Ernst
Post Follow-up to this messageErnst_Berg@sbcglobal.net (Ernst Berg) wrote in news:be9ae35b.0409191116.8156c33@posting.google.com: > > I have a coding question: > > I have an algorithm were I have coded for two events. > The first event may have zero or more bits. > The second will have one or more bits. > It is necessary to delimit each event. > > It not clear enough how do you distingish between to second events and a second event followed by a first event of zero bits followed by a second event. Your statements don't make logical sense to me. David A. Scott -- My Crypto code http://bijective.dogma.net/crypto/scott19u.zip http://www.jim.com/jamesd/Kong/scott19u.zip old version My Compression code http://bijective.dogma.net/ **TO EMAIL ME drop the roman "five" ** Disclaimer:I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged. As a famous person once said "any cryptograhic system is only as strong as its weakest link"
Post Follow-up to this messageErnst_Berg@sbcglobal.net (Ernst Berg) wrote in message news:<be9ae35b.0409191116.8156c33@po sting.google.com>... > I have a coding question: > > I have an algorithm were I have coded for two events. > The first event may have zero or more bits. > The second will have one or more bits. > It is necessary to delimit each event. > > I have coded this way: > > For the first event I use zeros and for the second I use ones > terminated by a zero. > " 1011110000001000000011111000010 " > A first event will not follow a first event but, a second event may > follow a second event. > > > My Question is: Is there a better coding? Can I avoid the need for a > termination bit in the second event and still be able to have "back to > back" delimited second events? What do you mean by "better"? I think, Berg, your approach to the problem might be slightly flawed. You could also consider the situation like this. You have 2 types of event and events have a bitlength. If the bitlengths are constrained you could think of it as having 2*max_bitlength different events. If you then also have a frequency distribution for the events, you then may build a huffman code to get an optimal code. Now, there are too many "If"s here,and I might be missinterpreting you, because the information you provide is much too scant regards.
Post Follow-up to this message"David A. Scott" <daVvid_a_scott@email.com> wrote in message news:<Xns9569DCA309733H110W296 LC45WIN3030R@130.133.1.4>... > Ernst_Berg@sbcglobal.net (Ernst Berg) wrote in > news:be9ae35b.0409191116.8156c33@posting.google.com: > > > It not clear enough how do you distingish between > to second events and a second event followed by a first > event of zero bits followed by a second event. Your > statements don't make logical sense to me. > > > David A. Scott Right. I must leave for work but I will return to express my question in a better way tonight. Ernst
Post Follow-up to this messageguenther.vonKnakspott@gmx.de (Guenther von Knakspott) wrote in message news:<9e54a9f7.04091 92227.7dc1a4a4@posting.google.com>... > Ernst_Berg@sbcglobal.net (Ernst Berg) wrote in message news:<be9ae35b.0409 191116.8156c33@posting.google.com>... > > What do you mean by "better"? I think, Berg, your approach to the > problem might be slightly flawed. You could also consider the > situation like this. You have 2 types of event and events have a > bitlength. If the bitlengths are constrained you could think of it as > having 2*max_bitlength different events. If you then also have a > frequency distribution for the events, you then may build a huffman > code to get an optimal code. Now, there are too many "If"s here,and I > might be missinterpreting you, because the information you provide is > much too scant > > regards. I have not tried this approach but I like the enumeration ideal. I adopted a unary code but the seperate functions still interest me. I will look into this. Thank you. Ernst
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.