Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions