The classical algorithm for testing unique decipherability of codes is improved by using McCreight\´s algorithm for constructing suffix trees. The complexity of the algorithm is

where n is the number of codewords and m is their total length. Efficiency is gained by avoiding repeatedly comparing subwords of the codewords.