IT 面试题收集贴
Q1. You have an coin as information source which outputs a sequence of Heads and Tail string as "HHHHTTHTHTHT...". And this data is supposed to be communicated over a channel using the function bool send(char *); optimize the solution for maximum throughput.
A1:
1. 使用1bit 表示一个字符, 例如用1表示H, 0表示T,这样可以把"HHHHTTHTHTH"转化成"11110010101"..... 这里要注意,不能以0开始,否则,数据就不正确了
2. 对连续的1和0可以再考虑压缩一下