What is the time complexity of Huffman Coding ?

2025

What is the time complexity of Huffman Coding ?

  1. A.

    O(N)

  2. B.

    O(N logN)

  3. C.

    O(N (logN)^2)

  4. 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).

Explore the full course: Tpsc Assistant Technical Officer