A text concordance BST is a BST of all the distinct words in a piece of text, and in this project we consider the problem of constructing one concordance for a document stored in a file. To construct such a concordance BST, we begin with an empty BST. As each word is read, we will check the list whether it is in current BST or not. If the word is a new word, it is inserted into the BST in the appropriate place. If the word you read appears in the BST already, the frequency of the word will be increased by one. Obviously, it may be necessary to insert words at any point in this BST. Each node consists of four fields, one for word, one for its frequency, and two for right/left child link(reference) fields.
Each time a word is read from a document, this BST must be searched, always beginning with the rootnode.
(The data type of the word field would be a string. If the word starts with non-alphabet(number or special symbol) do not insert it in the list. Also the characters of all words will be upper case only without any punctuation.)
Input : A Text file (concordinput.txt)
Function : Construct a text concordance BST from a document stored in a file.
Output :
1. A list of distinct words with their frequencies in an ascending alphabetic order by using inorder traversal method.
2. A list of words in the same format of Figure 4.7 in the text (pp. 105) using a preorder traversal method.