Which of the following algorithms is the best approach for solving Huffman…
2024
Which of the following algorithms is the best approach for solving Huffman codes ?
- A.
exhaustive search
- B.
greedy algorithm
- C.
brute force algorithm
- D.
divide and conquer algorithm
Attempted by 98 students.
Show answer & explanation
Correct answer: B
Huffman coding is solved using a greedy algorithm. At each step, the algorithm selects the two nodes with the smallest frequencies and combines them into a new node. Repeating this locally optimal choice builds an optimal prefix-code tree. Therefore, the best approach among the given options is the greedy algorithm.