Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions