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

  Write program that simulate the operation of bank account

Your task is to write a program (detailed specifications below) that will simulate the operation of an ATMYenabled bank account with multiple linked cards. In other words, there will be several individuals who can access an account, each with his/..

  Prepare a php form which allows input for an individual and

create a php form that allows input for an individual and displays the information on a subsequent page upon

  Discuss few web service tools

We have discussed a few web service Following are the Unit testing tools. In your opinion, are they really useful?

  Explain the principle of programming to an interface

In your own words, explain the principle of programming to an interface. This explanation is meant to help develop your peers' understanding and should be written in as simple terms as possible

  Discuss the requirements of a linear programming model

Discuss the requirements of a linear programming (LP) model. Provide an example of an LP model and define each variable used. What are the key steps that need to be considered when formulating an LP problem

  create a web page that uses a JavaScript program

Each line, after the first line, must only be output when the user clicks "Ok" in response to the alert.

  Write pseudocode statements to declare four integers

Write Pseudocode statements to Declare 4 Integers. You can decide on the variables names of each of the integers.

  Appropriate for two classes to inherit from superclass

CDs and DVDs have several common characteristics. Would it be appropriate for these two classes to inherit from a common superclass?

  Creating a software package for amazon

Suppose you are creating a software package for Amazon.com that needs users to enter their own passwords. Your software requires that users' passwords meet the following criteria:The password should be at least six characters long.

  Write sql commands

Consider the following tables FACULTY and COURSES. Write SQL commands for the

  Create a form application

Create a form that has a text area that will hold Mission Title and Adjusted Total Box Office Profit data.

  Create the gui for object-s processing methods

Create pseudocode for each of the classes. Create the GUI which will make the objects and give access to each object's processing methods.

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