Design greedy algorithm to solve activity selection problem

Assignment Help JAVA Programming
Reference no: EM131410019

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

Question 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.

Verified Expert

The solution file is implemented in netbeans which contains two programs. They are the first program is to implement the Boyer Moore algorithm to find pattern and good suffix table second one is implement the greedy algorithm to find the maximum number of activities can allocate . The screen shorts of both programs are attached here.

Reference no: EM131410019

Questions Cloud

Define responsibilities and duties of the strategic manager : Describe and define internal and external analysis. Describe and define the responsibilities and duties of the Strategic Manager. Explain why companies need strategic management planning.
How would you categorize the types of knowledge : How would you categorize the types of knowledge? How and where would someone acquire and learn this knowledge? How do you gain access to the people and places this can be learned? Is this access generally equal in the US
Indicate a relationship between two interesting variables : Indicate a relationship between two interesting variables. Which variable do you think is the dependent variable in the relationship? Which is the independent?
What questions would her sphr friend ask betty smith : MGT 407- What questions would her SPHR friend ask Betty Smith? Do you think it is a good idea for the CEO to bring a gun to work? Justify your response. Consider the Second Amendment.
Design greedy algorithm to solve activity selection problem : Write a program to implement the Boyer-Moore algorithm. Your program should ask the user to enter a text and a pattern, then output. Design a greedy algorithm to solve the activity selection problem.
What does the criminal court offer in terms of punishment : An important thing to look at in your example is what does the criminal court offer in terms of punishment that the juvenile court can't offer here
Estimate the inductance of the capacitor : An X7R type 0.022 µF capacitor has a dissipation factor (1 kHz, 1 V (r.m.s.)) of 1.5% and a self-resonance at 30 MHz. Given that the e.s.r. at resonance is 0.056
How many units should be stocked : At the end of the day, units not sold at the store are disposed of, and the retailer receives just $1 for each. Given the following probability distribution describing daily demand, how many units should be stocked?
What are the potential damages that can occur : Juvenile court judges should carefully consider all potential outcomes and I personally think that we should work to close these loopholes. What are the potential damages that can occur when a judge transfers non-violent offenders

Reviews

inf1410019

3/30/2017 5:35:18 AM

This is algorithm we have to implement source code based on algorithm only. if u refer any data structure book to develop algorithm we have to design algorithm steps.

inf1410019

3/30/2017 5:35:06 AM

JAVA Programming in java and please no plagiarism please make sure to follow the instructions Analysis of Algorithms

len1410019

3/2/2017 12:47:44 AM

Please make sure that the good suffix table is generated correctly. Use the following examples to test your program before submitting your assignment.Write a program to implement your algorithm.

Write a Review

JAVA Programming Questions & Answers

  Program to convert fahrenheit to celsius

Layout the planned structure and steps to accomplish the individual programs. Ensure brief, accurate and complete detailed instructions in the form of pseudocode, not code. Construct two brief explanations for the pseudocode. Provide both programs..

  Why does tomcats first servlet request take so long

Why does Tomcat's first servlet request take so long? How do I disable port 8080? I want Tomcat to run only through my Web server, not directly through Tomcat.

  Implement avl trees that allows both iterative traversal

implement avl trees that allows both iterative traversal and recursive traversal.iterative traversal is fairly easy if

  Write a program of the dating game

The Dating Game Table of Contents for each section of this submission (i.e. Source Code listing, screen captures and UML design) here….Also, may include Javadoc source here.

  Allow the user to display a work history report

The 'report screen' shall:Allow the user to display a work history report for an individual or for all employees for the two weeks prior to the report request.

  Simulate distributing furniture from wholesale to stores

A Wholesale furniture distributing company in Florida is providing furniture to 4 furniture stores. Write an application to simulate distributing furniture from Whole sale center to different stores.

  Your program should ask the user to input a grade

Your program should ask the user to input a grade (integer from 1-100) and then output the letter grade.

  Program to calculate the average of 5 numbers entered.

Show what the PC monitor will show when the program is executed with the following values used: 27, 12, and 15.

  One-dimensional array to solve the

In C#, Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who gros..

  Live nodes and garbage collection in java

For a list with n Nodes, what is the maximum number of nodes that are "live" (i.e., accessible from a "root set" of variables) during the method inverse(), and when does this maximum occur?

  How threads are used to implement currency in java

Describe the concept of concurrency and how threads are used to implement currency in Java

  Adopting a working game of ping pong in java

Create a new Java project. You will be porting each of the classes from the example code to swing, so its better to code in empty class and fill in the details - Object-Oriented Design in Java

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