Question: Assignment - 6 : Binary Seach Tree Write a program with the following two functions: input a text in a line. The words in the
Assignment : Binary Seach Tree
Write a program with the following two functions:
input a text in a line. The words in the text are inserted into a binary search
tree with the number of its appearances. The order of insertions is according to
the sequence of appearances in the text. It discards any nontextual character
such as comma, dots, or digits. We assume that the words are not casesensitive
and uppercase must be converted into lowercase and the number of words in a
line does not exceed
print the binary search tree with the following rules:
tree:
if tree is empty
word:frequency if it is a leaf node instead of word:frequence
word:frequencyrightSubtree if leftSubtree is empty
word:frequencyleftSubtree if rightSubtree is empty
word:frequencyleftSubtreerightSubtree
if left and right subtrees are not empty
input: ll bba aaa mmm bbc zzz xxx Aaa
output: :bba:aaa:bbc:mmm:zzz:xxx:
Example
Neither STL nor any libraries are allowed. This program should be implemented
from scratch not by using any builtin libraries or functions
No ChatGPTAI can be used, do not include the given examples in the code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
