character set has 1 and 2 byte characters. One byte characters have 0 as the first bit. You just
keep accumulating the characters in a buffer. Suppose at some point the user types a backspace, how
can you remove the character efficiently.
one solution that came in my mind is that there is no need to think about one byte characters (it has 0 as most significant bit) and only we need to think about 2 byte characters and how it could be differentiated from 1 byte character.I thought to include and extra bit (say 0) to 2 byte char to distinguish it but that would eat up many character representations.
suggest an idea!
What do you mean first bit?
In the 2-octet value
0xfade(0b1111101011011110) is the first bit a0or a1?Anyway, you can arrange to write the values in little-endian or big-endian format to have the “first bit” always written last. By examining only the last octet written you know whether to delete 1 or 2 octet.