Given a binary encoded string and a Huffman MinHeap tree, your task is to complete the function decodeHuffmanData(), which decodes the binary encoded string and return the original string.
Input Data : AAAAAABCCCCCCDDEEEEE Frequencies : A: 6, B: 1, C: 6, D: 2, E: 5 Encoded Data : 0000000000001100101010101011111111010101010 Huffman Tree: '#' is the special character used for internal nodes as character field is not needed for internal nodes. #(20) / \ #(12) #(8) / \ / \ A(6) C(6) E(5) #(3) / \ B(1) D(2) Code of 'A' is '00', code of 'C' is '01', .. Decoded Data : AAAAAABCCCCCCDDEEEEE
The function takes two arguments as input, the reference pointer to the root of the Huffman minheap tree and an binary encoded string.
There will be T test cases and for each test case the function will be called separately.
Note: Input test cases contains English alphabetical string of size N, that will be encoded using Huffman Encoding and the encoded string will be provided to you.
For each test case print the decoded string from the provided encoded string.
Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.