Arrange the message in ascending order according to their frequency

Merge two minimum frequency message

Rearrange in ascending order

Merge two minimum frequency message

Again Rearrange in ascending order

Huffman code

A = 0

B = 111

C = 110

D = 100

E = 101