Huffman coding is a lossless data compression algorithm. The most frequent character gets the smallest code and the least frequent character gets the largest code. Consider the following statements regarding Huffman coding algorithm?

S1 : The time complexity of the Huffman algorithm is O(nlogn). Using a heap to store the weight of each tree, each iteration requires O(logn) time to determine the cheapest weight and insert the new weight. There are O(n) iterations, one for each item.

S2 : If the input array is sorted, there exists a linear time algorithm.

S3 : A divide-and-conquer approach might have us asking which characters should appear in the left and right subtrees and trying to build the tree from the top down. As with the optimal binary search tree, this will lead to to an exponential time algorithm.

Which of the following option is correct?

**(A)** Statement S1 is correct, Statements S2 and S3 are not correct.

**(B)** Statements S1 and S2 are correct and statement S3 is not correct.

**(C)** Statements S2 and S3 are correct and statement S1 is not correct.

**(D)** All statements S1, S2, and S3 are correct.

I am not getting proper explanation on Geekforgeeks for this question.