Write a program to implement the boyer-moore algorithm

Assignment Help JAVA Programming
Reference no: EM131406749

Question 1. Write a program to implement the Boyer-Moore algorithm. Your program should ask the user to enter a text and a pattern, then output the following: (a) bad-symbol table (b) good suffix table (c) the searching result (whether the pattern is in the text or not)
Please make sure that the good suffix table is generated correctly. Use the following examples to test your program before submitting your assignment.

Examples:
Good suffix table for the pattern BAOBAB
k = 1 d2 = 2; k = 2, d2 = 5; k = 3 d2 = 5; k = 4 d2 = 5; k = 5 d2 = 5
Good suffix table for the pattern AACCAC
k = 1 d2 = 2; k = 2, d2 = 3; k = 3 d2 = 6; k = 4 d2 = 6; k = 5 d2 = 6
Good suffix table for the pattern AACCAA
k = 1 d2 = 1; k = 2, d2 = 4; k = 3 d2 = 4; k = 4 d2 = 4; k = 5 d2 = 4
Good suffix table for the pattern 10000
k = 1 d2 = 3; k = 2, d2 = 2; k = 3 d2 = 1; k = 4 d2 = 5
Good suffix table for the pattern 01010
k = 1 d2 = 4; k = 2, d2 = 4; k = 3 d2 = 2; k = 4 d2 = 2

2. Design a greedy algorithm to solve the activity selection problem. Suppose there are a set of activities: a1, a2, ...an that wish to use a lecture hall. Each activity ai has a start time siand a finish time fi. A lecture hall can be used by only one activity at a time. Two activities can be scheduled in the same lecture hall if they are nonconflicting (fi<= sj or fj<= si) Your algorithm should find out the minimum number of lecture halls needed to hold all the activities. Write a program to implement your algorithm. For example: if the activities you need to schedule have the following start times and finish times,
4 7
6 9
7 8
1 3
1 4
2 5
3 7
then the output of your program is "the minimum number of lecture halls required is 3". Also indicate which activity will be scheduled in which lecture hall.

Reference no: EM131406749

Questions Cloud

Current registration methods in a non-digital : The data collected will be used for students accepted to Willowbrook, and should contain information for both the academic program and after-care programs. Keep in mind that Willowbrook conducts their current registration methods in a non-digital,..
Develop accurate and complete data models : Referring to these, discuss which concepts you utilized to develop these data models. Also discuss how you utilized them.
Describe law enforcement roles and responses : Explain, in detail, what you believe to be the greatest challenge facing law enforcement agencies investigating exploitation, cyber stalking, and obscenity. Identify the specific challenges that overlapping of jurisdictions pose in the fight agai..
How to create a culture and structure for innovation : What is Organizational Culture and Why is it Important? Relationship Between Organization Culture and Structure. Aligning Organization Culture and Structure. How to Create a Culture and Structure for Innovation?
Write a program to implement the boyer-moore algorithm : Write a program to implement the Boyer-Moore algorithm - Design a greedy algorithm to solve the activity selection problem. Suppose there are a set of activities: a1, a2, ...an that wish to use a lecture hall. Each activity ai has a start time sia..
Identify penetrations and hurdle the point-in-time : Determine the types of monitoring that could be implemented to help quickly identify penetrations and hurdle the "point-in-time" security protections that regulations, such as PCI, provides.
Describe the prototyping process of designing forms : Describe the prototyping process of designing forms and reports. What deliverables are produced from this process? Are these deliverables the same for all types of system projects? Why or why not?
Problem regarding the copyright protection : Invisible watermarking is a popular method for copy prevention and control. Can invisible watermarks absolutely resolve ownership disputes?
Compare the ways in which packards crime-control model : Law enforcement in America has seen drastic changes over the past one hundred years, from the educational requirements of officers to the interpretation of the bill of rights. Law enforcement officers today are expected to perform their duties at ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a method called add uneven arrays

Write a method called addUnevenArrays that takes two arrays, a and b, and returns a new array, c, with alength that is the maximum of the lengths of a and b. Each c[i] is the sum of the corresponding elementsof a and b if both elements exist.

  Define get and set functions and two constructors

Create a class called Building. It will have one data member of type string (used for a postal address). Define get and set functions and two constructors.

  Models checkout lines at a supermarket

Java programmingT1. Write a program that models checkout lines at a supermarket; you have to use one of the data structures being covered in the lectures and explain why your choice of the data structure is well justified. Several lines of customers ..

  Create a class for services offered by a hair-styling salon

Create a class for services offered by a hair-styling salon. Data fields include a String to hold the service description and write an application named Salon Report that contains an array to hold six Service objects and fill it with the data

  Code layout, use of variable names highlight the java code

Java Code high-lighting, things like code layout, use of variable names, general readability and understandability

  The class overloaded constructor receives a 2-dim int array

The class overloaded constructor receives a 2-dim int array as a parameter and assigns its values to a private 2-dim int array. Have another method that prints the whole 2-dim table.

  Implement elliptic curve encryption - decryption in java

Implement Elliptic Curve encryption - decryption in java. Specifically, your program will read parameters, plaintext and ciphertextfrom a file

  Create a sketch that draws this image using processing

Your task is to create a sketch that draws this image using Processing (the gray is the background): You are not allowed to use images, you must recreate the image using drawing commands such as rect(), triangle(), etc.

  Create a application that will present a survey to customers

You have been asked by your manager to create a user-friendly application that will present a survey to your customers. The application will compile and analyze the results entered by the survey respondents.

  Problem related to eclips

Goals: 1) Be able to work with individual bits in java. 2) Understand the serializable interface. 3) Understand the comparable interface.

  Print the number of lines the number of words

a java program where im supposed to print the number of lines the number of words and the longest line in a text file!

  Prompt the user for an int between an upper and lower

prompt the user for an int between an upper and lower boundary. reuse the validateinput method from project to validate

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd