Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program named text_indexing.c that does the following 1. DO NOT read the filename as part of the program input or as command line

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Write a program named text_indexing.c that does the following 1. DO NOT read the filename as part of the program input or as command line arguments (do not write any code to read from a file).The program must read the data as user input and be able to use data from a file by redirecting the input as shown in the sample run 2. Reads text and stores it as one string called text. You can read from a file or from the user. (In my implementation, I read only one paragraph (up to new line) from the user. With this same code, I am able to read data from a file by using input redirection (executable filename) when I run the program. See sample runs below). You cannot open (and read) the file more than once. 3. You can assume that the text will not have more than 10000 characters. 4. You can assume that each of the words being searched has at most 100 characters. 5. We want to be able to perform fast searches in this text. We will index it by keeping the indexes where each word starts in alphabetical order 6. Find, store (in an array) and print the index for each word and the word itself. They should show in the order in which they appear in the text. (See sample run.) 7. Sort using INSERTION SORT the indexes and print again the indexes and the words. They should show in sorted order now.(See sample run.) 8. The sorting must be case insensitive for the first letter. That is, if the first letter of any of the two words you are comparing is upper case, you must use the lower case value in your comparison. (Notice in the sample run with datal.txt that 'Chemical' is placed after 'application'.). You may want to write your own string compare method. 9. When searching for words (with binary search) count the number of words you look at until you get the answer (found or not found). Display that number in the run. 10. When searching (not when sorting) you should ignore the punctuation at the end of words. See the run with data0.txt /textidx.exe data@ , txt Enter the text: preeesses-feundfHteretionupdated 9/13 @ 7:55 am praeeesses.-nafound_f4eratier updated 9/13 @ 7:55 am (original: processes) cleaned: processes found (3 iterations) (original: processes.) cleaned processes - found (3 iterations) 11. REQUIREMENT: you must NOT make a copy of the data. That is, you must keep it still as one long string and process the words in it. DO NOT create an array of individual words. (-35 points if you make an array. If you do make the array, it should NOT be in sorted order. The goal here is to use indirect sorting and if you create a sorted array you would not be doing an indirect sort. You will sort the indexes into this array. See the indirect sorting with selection sort in the

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

Step: 3

blur-text-image

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

3. Describe the strategic training and development process.

Answered: 1 week ago

Question

10. Microsoft Corporation

Answered: 1 week ago

Question

4. EMC Corporation

Answered: 1 week ago