Question: Write a program that prompts the user for a file name and opens that text file.Example text file to be used is LesMis.txt, found at

Write a program that prompts the user for a file name and opens that text file.Example text file to be used is LesMis.txt, found at www.gutenberg.org (don't need to use this specific text file). Then also prompt the user for a string A. Read in the text file string by string and determine whether each string in that text file contains your input string A as a substring. Count how often this is the case and display that number at the end. Also measure the time that elapsed to process the complete file and display this as well.

To show the difference between the various list implementations of the ADT List provided in the Java Collections Framework (ArrayList and LinkedList), repeat the task, the first time representing all strings as an ArrayList and the second time as a LinkedList. Substring matching is a surprisingly complex problem (when striving for efficiency), we may revisit this later once we introduced more ADTs. For the time being, use the following brute-force substring matching algorithm (it is okay if in your solution you do not declarefindBrute() to be static).

Write a program that prompts the user for a file name and

Your program should produce output similar to the one shown below. Obviously the timing is hardware-dependent and may well differ on different computers and implementations. To not bias your expectations, Ive xxx-ed out the values, your final solution should provide some actual measurement here.... The counts though should be the same across all platforms and implementations.

opens that text file.Example text file to be used is LesMis.txt, found

at www.gutenberg.org (don't need to use this specific text file). Then also

Returns the lowest index at which substring pattern begins in text (or *else-1) private static int findBrute (List text, List pattern) { int n- text.size int m = pattern. size(); for (int i - 0;

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!