sec huffman coding trees /build huffman tree from list hufflist static hufftree buildtree(list hufflisthufftree tmp tmp tmp lettfreq tmpnodefor(hufflist movetopos( )hufflist length( hufflist movetopos( )/while at least two items left hufflist movetostart()tmp hufflist remove()tmp hufflist remove()tmpnode new lettfreq(tmp weight(tmp weight())tmp new hufftree(tmpnodetmp tmp )/return to the list in sorted order for (hufflist movetostart()hufflist currpos(hufflist length()hufflist next()if (tmp weight(<hufflist getvalue(weight()hufflist insert(tmp )break/put in list if (hufflist currpos(>hufflist length()hufflist append(tmp )/this is heaviest value hufflist movetostart()return hufflist remove()/this is only tree on list /return the tree figure implementation for the huffman tree construction function buildhuff takes as input flthe min-heap of partial huffman treeswhich initially are single leaf nodes as shown in step of figure the body of function buildtree consists mainly of for loop on each iteration of the for loopthe first two partial trees are taken off the heap and placed in variables temp and temp tree is created (temp such that the left and right subtrees are temp and temp respectively finallytemp is returned to fl figure an impossible huffman treeshowing the situation where the two nodes with least weightl and are not the deepest nodes in the tree triangles represent subtrees