Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Huffman coding is based on what Greedy Approach or Dynamic Programming

Can we solve Problem of Huffman Coding by using Dynamic Programming, Is there any algorithm


2 Answers

Huffman Coding works by creating a binary tree of nodes. These can be stored in a regular array, the size of which depends on the number of symbols, n. Huffman Coding can be implemented in O(n logn) time by using the Greedy Algorithm approach. Huffman Coding is not suitable for a Dynamic Programming solution as the problem does not contain overlapping sub problems.

like image 173
Deepu Avatar answered Feb 27 '26 03:02

Deepu


As per my knowledge about algorithms, I beleive huffman coding is based on Greedy approach. As we do in Activity selection problem. Task scheduling and knapsack problem are another examples of it.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!