Purpose

In this assignment, you will create an index for the complete works fo William Shakespeare (shakespear.txt). This will help you practice using binary trees and other data structures.

The Problem

An IndexTree is a special kind of Binary Search Tree that we'll use to build our text index, like the one you find at the end of a textbook. Since text files don't have traditional pages (without extra work to keep track of how many lines can fit in a particular print copy), we will use line numbers like those in your IDE.

The IndexTree contains a new node type that stores the word, the number of occurrences, and a list of all the lines that the word appears on. Nodes in the tree will be sorted by comparing the word data.

You must use an IndexTree object to store an index of all the words that are in the provided text file, then display the index by performing an inorder traversal of the tree. You must also provide functionality to allow someone to search the index for a keyword, displaying the keyword and a list of the lines that it is found on.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.