5, 8, 6 and k occur with frequency 3, 2, 4, and 1 respectively and…