How to tell if a code is lossless Consider the following code mapping:
$$a \mapsto 010, \quad b\mapsto 001, \quad c\mapsto 01$$
It's easy to see that the code isn't lossless by observing the code $01001$, which can be translated to "ac" or "cb".  
Given a general code, how can you tell if it's lossless or not? I don't think trial and error is the best approach (though for small examples like the one I presented it's enough).  

I think, simple answer will be to check for Prefix, Suffix codes. If the code words follow these properties they are uniquely decodable hence loss less. Huffman coding is best example of prefix coding. plz tell me if you want to know more and correct me if I am wrong.
