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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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