Objectives: 1) Understand and use recursion; 2) Understand and implement binary trees
Write a program that reads an input text file and counts the occurrence of individual words in the file. You will use a binary tree to keep track of words and their counts.
The program should open and read an input file (named input.txt) in turn, and build a binary search tree of the words and their counts. The words will be stored in alphabetical order in the tree. The program should ignore the case of the words, so that "Branch" and branch are considered the same. However, words that are actually spelled differently such as tree and trees are considered to be different, and should be stored in separate nodes. All words will be stored in the tree in their lowercase form. Help is provided on how to accomplish this.
Two forms of queries are to be supported by the tree class:
1. A query for an individual word should return the number of occurrences of that word in the input file, as retrieved from searching the tree, or should display a message stating that the word was not found in the tree.
2. A query for words that meet or exceed a threshold number of occurrences, should result in the output of the words (and their counts) that meet that criteria, using inorder tree traversal.
The nodes for the word tree should be a struct with the following members
a. A string containing the word itself.
b. One pointer each for the left and right subtrees.
c. An int containing the count of the number of occurrences of the word.
1. Your program must be split into 3 files. There will be a class (with separate interface and implementation files), and a driver file. The requirements for these are specified below:
a) The WordTree class- This class represents a word binary search tree
b) A driver, or client, file that
2. Sample output:
a) This output shows the program execution of primary functionality using a file containing excerpts from an earlier version of this assignment. That text is supplied to aid you in validation/testing see image.
3. Test your program - Use different data files and queries to test the program.