CSC220 Lab Number 8
Due: 11:59PM, Tuesday, November 10

The goal of this lab is to develop a code that reads a user-specified text file and does the following:

To do this, we will use a binary search tree whose nodes are objects from class WordPos, where WordPos is a class that implements Comparable and consists of a String object that stores the word and a LinkedList object that stores the locations.

Your tasks are the following:

Download the following files:

Below is the list of things to do:

  1. In BinarySearchTree.java, implement remove and contains method.
  2. In WordPos.java, implement iterator(), listIterator(), compareTo(), and add().
  3. Write a class that reads a text file, saves the information (word and location) in a tree of WordPos objects, and then outputs the result.
In writing the code, note that an input text may have characters other than English alphabet. Such characters include punctuation and numerics.

A sample program is here.