This is huffman coding solution, in this we are creating a min heap or a max heap?
hello @haseebshaik00 this is the max heap in the code:
note that by default c++ forms the max heap only but here you have to arraynge them according to their frequemcy that is why we have used this syntax.
Happy Learning !!
I referred the code from this article, and here the author has created a min heap by the statment return
a->freq > b->freq;
can you please tell how it is a min heap and not a max heap?
Hello @haseebshaik00 yes i am sorry this is the min heap only . in the sense that whose frequency is smaller should comes first.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.