What is the time complexity of Huffman Coding ?
2025
What is the time complexity of Huffman Coding ?
- A.
O(N)
- B.
O(N logN)
- C.
O(N (logN)^2)
- D.
O(N^2)
Attempted by 93 students.
Show answer & explanation
Correct answer: B
Huffman Coding builds a binary tree using a min-heap. Each of the N characters requires O(logN) heap operations, resulting in total time complexity of O(N logN).