Why are we doing this step?

int l1=yy.freq;

while(l1–)//Emptying the heap

pq.pop();

int l1=yy.freq; while(l1–)//Emptying the heap pq.pop();