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 -6: 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 non-textual character
such as comma, dots, or digits. We assume that the words are not case-sensitive
and upper-case must be converted into lower-case and the number of words in a
line does not exceed 100.
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:frequency(-,rightSubtree)-- if leftSubtree is empty
word:frequency(leftSubtree,-)-- if rightSubtree is empty
word:frequency(leftSubtree,rightSubtree)
-- if left and right subtrees are not empty
input: 111 ll bba aaa mmm bbc zzz xxx Aaa
output: 111 :1(bba:1(aaa:2,bbc:1),mmm:1(-,zzz:1(xxx:1,-)))
Example
Neither STL nor any libraries are allowed. This program should be implemented
from scratch not by using any built-in libraries or functions
No ChatGPT(AI) can be used, do not include the given examples in the code
Assignment - 6 : Binary Seach Tree Write a

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 Programming Questions!