Construct a markov algorithm

Assignment Help Programming Languages
Reference no: EM131213513

1) Construct a Markov Algorithm that will reverse the order of an input string that consists of zero or more upper case letters. ABCDE should become EDCBA, AB should become BA, A should stay A, and A should stay A. NOTE: Your algorithm must handle strings of ANY length, not just length 0-5. Demonstrate that your algorithm works by constructing a table similar to Table 1.11 on page 37 of the text for each of the input strings A, A, AB, ABC and ABCD (a separate table for each input).

To reduce the size of these tables, show only the lines where the rule succeeds. For example, using this approach, Table 1.11 would become simply

Rule Success or Failure          String

3                       S                      αABC

1                       S                      BαAC

1                       S                      BCαA

2                       S                      BCA

2) If A appears on the LHS of a rule, it only makes sense for it to appear alone. It also only makes sense for that rule to be your last rule, because it will always be satisfied. It will always have the following effect: whatever is on the RHS of that rule (except the period, if there is one) will be put at the beginning of your working string.

3) If A appears on the RHS of a rule, it only makes sense for it to appear alone (except that it may be followed by a period). The substring of your working string that matches the LHS of this rule will be deleted when this rule executes.

4) The original input string will always consist of a string of zero or more upper case letters (A-Z). It is possible for the input string to be empty (A).

5) Your rules can introduce new characters that can appear temporarily in the working strings. These characters will be lower case Greek symbols like, a, 13, y, etc. In general, it makes sense for these symbols to not appear in the final result, but while they are there, they should be treated just like the upper case letters in that they can satisfy a match for a variable just as well as an upper case letter. For example, if the rule being looked at is xy -> yx and the current string is aAB, then the rule would change the string to AaB.

6) The lower case letters (a-z) are variables that match exactly one symbol (they do not match A). As I said above, they can match an upper case letter or a lower case Greek letter.

7) An upper case letter or lower case Greek letter on the LHS of a rule is like a constant and must be matched exactly in the working string (upper case letters don't often appear in rules, however).

8) Every time a rule actually executes, you start by considering the rules from the top again and you start by looking at the beginning of the current string.

Execution stops either when a rule that ends with a period is executed or if the working string does not cause any of the rules to fire.

In one last attempt to clarify questions before they occur, here is a table that shows a few examples (please note that each example is independent of the others):

Rule Being Considered                       Current String                        Match?                          String Afterwards

axY -> Yax                                           ABC                                       No                                        ABC

cocY -> Yax                                         CaAB                                    Yes                                        CBaA

axY -> Yax                                           aA13                                   Yes                         (3aA (please note!)

coW -> Yax                                          BaA                                        No                                         BaA

xy -> A                                                  ABC                                      Yes                                   C (and quits)

xy -> A.                                                 AaB                                      Yes                                   B (and quits)

xy -> A.                                                 B                                          No                                           B

A ->13                                                 ABC                                       Yes                                        ABC

A -> p                                                  ABC                                        Yes                                     P13ABC

A -> p                                                    A                                          Yes                                         13

Reference no: EM131213513

Questions Cloud

What will the new current spot exchange rate be : What is likely to be the effect on the spot exchange rate if the interest rate on 60-day pound-denominated bonds declines to 8 percent?
Constitution regarding cyber law : 1) Discuss proposals to add an amendment to the U.S. Constitution regarding cyber law. 2) Discuss aspects of the U.S. Constitution that would concern such a law, including the 1st, and 4th Amendments regarding individual rights and law enforcement..
Would you terminate omega as the management company : Based on the information given in the case, would you terminate Omega as the brand (and management company) and select another brand? You need to list and describe three reasons why you would (or would not) do so.
What will happen in the foreign exchange market : If uncovered interest parity holds, what spot exchange rate do investors expect to exist in 90 days?- What will happen in the foreign exchange market?
Construct a markov algorithm : Construct a Markov Algorithm that will reverse the order of an input string that consists of zero or more upper case letters - It will always have the following effect: whatever is on the RHS of that rule (except the period, if there is one) will b..
Can you do it without using a lock statement : Can you do it without using a lock statement? Compare your solution to that of the previous exercise. Which is simpler?
Requires the federal emergency management agency : Requires the Federal Emergency Management Agency, (FEMA) Regional Administrators to identify the issues in their regions with regards to special needs populations.
How would you react to each of the given news items : As a foreign exchange trader, how would you react to each of the given news items as it flashes on your computer screen?
Show that the demand driven concurrent model is declarative : However, there are other ways to define the need relation that also result in declarative models. For this exercise, try to find at least one such definition.

Reviews

Write a Review

Programming Languages Questions & Answers

  Compute the total sales and commission rate applied

Write a program that prompts a salesman to enter his-her status and total sales. Compute the following: their status; total sales; commission rate applied; the commission ($) earned (the appropriate rate times the sales)

  Write non-recursive to perform algorithm

Write a non-recursive (i.e., iterative) function selectionSort() to perform this algorithm. Use it in a program that reads from a file a sequence of integers.

  Write program for department of motor vehicles

Department of motor vehicles has finally decided to computerize its list of licensed drivers. Program you write must make use of existing file call Licenses with records of given form. Name, License Number

  Linear programming staffing problem

South Central Utilities has just announced the August 1 opening its second nuclear generator at its Baton Rou, Louisiana, nuclear power plant.

  Write a program that instantiates four sphere objects

Write a program that instantiates four sphere objects (assigning a radius to each instance) and adds them to a pointer-based linked list. Include a function to display the statistics of each sphere in the list.

  Create a crosstab query

Create a crosstab query to show how many enrollments took place in various conventions from different companies. Also show the total number of enrollments in each convention.

  Calculating the center of mass of red markers

In the video clip, the monkey is moving. Firstly, red markers create on head, body, hands and feet of monkey. And then track the monkeys' movement with calculating the center of mass of red markers

  Write a subroutine that keeps prompting for a filename

Write a subroutine that keeps prompting for a filename until a valid file is entered by the user (print out "file found, thanks") or until five attempts have failed (print out "you did not enter a valid file name"). Call the subroutine from the main ..

  Write a program to use function

The program ends the first time that the user chooses not to delete a value from the array. Your main function may also call other functions to carry out some of its work - Here is an example execution of the required program (input typed by the us..

  Develop a functional web-based application for a calculator

Develop a functional web-based application for a calculator. It does not need to be live; you can provide JavaScript, CSS, and HTML files. The calculator should successfully complete addition, subtraction, multiplication, and division operations.

  Create a class diagram and define the classes

Completed class diagram should show each object's encapsulated methods, the inheritance between subject and course, and the composition of students in courses.

  Design program to calculate amount of money spend

Design a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day.

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