Question: Should be written in Java. The objective of this programming project is to construct a cross-reference index for a given text file. Such index structures

 Should be written in Java. The objective of this programming project

is to construct a cross-reference index for a given text file. Such

Should be written in Java.

The objective of this programming project is to construct a cross-reference index for a given text file. Such index structures have applications in the design of compilers and databases. Our task is to write a program that while reading a text file collects all words of the text and retains the numbers of the lines in which each word occurred. When this scan is terminated, a table is printed showing all collected words in alphabetical order with lists of line numbers where they occurred. There would be only one line for each word. Represent the words encountered in the text by a binary search tree (also called a lexicographic tree), For example, if there were three words 'abracadabra, 'hocuspocus, and 'watchamaycalli hocuspocus' would be the root with 'abracadabra' its left child and 'watchamaycalli' its right child. Each node not only contains a word as key value, but is also the head of a list of line numbers. Make the following assumptions regarding the text file: 1. Only lower case letters, digits, punctuation marks (eg.,'.. etc.), blanks, and the newline control character . ' are present in the input text file. The end of the file is signified by the character'#' 2. A word is considered as any sequence of letters and digits starting with a letter. The end of a word is marked by a blank, a punctuation mark, or a newline character 3. Punctuation marks are not part of any word. 4. It is desirable that, for a particular word, the line numbers are printed in ascending order in the cross-reference index. 5. Each word is at most ten characters long. All characters beyond that in a word are ignored. Two words are the same if their first ten characters match A sample run of the program on a text file civilzation of sclence. science is knowledge. knowledge is our destiny. should produce

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