Question: Fix the bug in chap 5 - BTPostOrderTraNonRec.cpp . This code is used to first construct a binary tree from the input ABC##DE#G##F##

Fix the bug in "chap5-BTPostOrderTraNonRec.cpp". This code is
used to first construct a binary tree from the input
"ABC##DE#G##F##", then perform the non-recursive PostOrder
traversal algorithm using an auxiliary stack on the constructed tree
to get the output sequence "CGEFDBA". There is only ONE bug
in the function PostOrderTraverse_norecursive(), which can
be fixed by adding one statement. Correct excution of the
revised code is as follows.
Design a Huffman coding/decoding system, which can encode and
decode the messages to be transmitted. When you build a
Huffman tree, you need put the smaller weight on the left and the
larger one on the right. The right child tree is encoded as 1, the left
one is encoded as 0. Note: using the encoding prefix nature.
Input
Enter a positive integer n representing the size of the character set
(n100) as well as n characters and n weights (weight is a
positive integer. It has a larger value, then it has the greater
probability of occurrence); You need to enter messages whose
length is smaller or equal to 100.
Output
The output of the system is the encoding binary code taking a line;
and the corresponding messages taking a line; Finally, a carriage
return is output.
 Fix the bug in "chap5-BTPostOrderTraNonRec.cpp". This code is used to first

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!