1.

What is the running time of the Huffman encoding algorithm?(a) O(C)(b) O(log C)(c) O(C log C)(d) O( N log C)This question was addressed to me during a job interview.This intriguing question originated from Greedy Algorithms in chapter Greedy Algorithms of Data Structures & Algorithms II

Answer»

Correct option is (c) O(C log C)

The BEST EXPLANATION: If we MAINTAIN the trees in a priority queue, ordered by weight, then the RUNNING time is GIVEN by O(C log C).



Discussion

No Comment Found

Related InterviewSolutions