Question

In: Computer Science

Problem 1: Problem 2: Assume that any number of 1s side-by-side represent a number, with the...

Problem 1:

Problem 2:
Assume that any number of 1s side-by-side represent a number, with the value of that number being

the number of 1s that appear. For example:

011111110

represents the number 7. (This style of representing numbers is referred to a unary notation – it’s generally not used anywhere but number theory / set theory.)

Write a Turing machine that computes the remainder of its input when that input is divided by 3. Given, for example, the following input tape:

running your program should produce the following result:

Problem 3 – Duplicating a number

Implement a Turing machine program that copies an input value on the tape, leaving two identical values separated by a single 0. For example, if the input tape is:

The result should be:

problem 4:

Below find the states for a 4-state Turing machine that, when starting with a blank tape, produces 13 1s. Your task in this extra credit problem is to write a 4-state Turing machine that produces at least eight but no more than twelve 1s before stopping.

It may be useful to look at the following 3-state Turing machine and use it for ideas on how to make your 4-state Turing machine. Note, though, that there are many solutions to this problem, and that only some of these solutions resemble the 3-state machine below.

Solutions

Expert Solution

problem 2: We will denote state transition using the triple (x,y,D) where x is the inout symbol we got , y is the change we did at that point in tape and D = L or R ie the direction left or right we moved in the tape. So the tape for 7 divided by 3 is given below

Now in algorithm the number of 1's in the dividend will be changed to X and the number of 1's left before the rightmost zero symbol will be the remainder and the number of 1's after the rightmost zero will be the quotient.

Now here is the state transition diagram for the algorithm.

The number of 1's left in the dividend in the figure above will be your remainder. Rest all ones dividend will be replaced by X.

Problem 3:

The steps for duplicating are given below

  • Step-1. First convert all 0’s, 1’s into 0’s, 1’s and go right then B into C and go left
  • Step-2. Then convert all 0’s, 1’s into 0’s, 1’s and go left then
  • Step-3. If 1 convert it into X and go right convert all 0’s, 1’s into 0’s, 1’s and go right then convert C into C and go right then convert all 0’s, 1’s into 0’s, 1’s and go right then convert B into 1 and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert C into C and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert all X into X and go right and then repeat all the process from step-2 till end
  • Step-4. If 0 then convert it into Y and go right then convert all 0’s, 1’s into 0’s, 1’s and go right then convert C into C and go right then convert all 0’s, 1’s into 0’s, 1’s and go right then convert B into 0 and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert C into C and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert all Y into Y and go right and then repeat all the process from step-2 till end
  • Step-5. Otherwise if C found convert it into C and go left then convert all X into 1 and Y into 0 and go left then convert B into B and go right and stop the machine.


Related Solutions

The binary number system uses just two digits (0 and 1) to represent any counting number....
The binary number system uses just two digits (0 and 1) to represent any counting number. Match each of the familiar 'base-10' numbers below with their 8-digit binary equivalents. Group of answer choices 7       [ Choose ]            00001111            01000001            00001101            00001000       8       [ Choose ]            00001111            01000001            00001101            00001000   ...
Who does the demand side of the market represent? Who does the supply side of the...
Who does the demand side of the market represent? Who does the supply side of the market represent? How does movement in the demand curve and the supply curve affect market equilibrium? Your response to the last question should reference the shifts in the supply and demand curves and changes in the equilibrium price and equilibrium quantity.
Who does the demand side of the market represent? Who does the supply side of the...
Who does the demand side of the market represent? Who does the supply side of the market represent? How does movement in the demand curve and the supply curve affect market equilibrium? Your response to the last question should reference the shifts in the supply and demand curves and changes in the equilibrium price and equilibrium quantity.
2. Let x be the number of years after 2007 and y represent the number of...
2. Let x be the number of years after 2007 and y represent the number of students enrolled at WWCC. Answer the following given the data that enrollment was 2055 in the year 2007, 2244 in 2008, 2512 in 2009, 2715 in 2010, and 2765 in 2011. (a) Find the least-squares line for the data using Excel and submit your file in Canvas. (b) Using partial derivatives, verify the formula you obtained in Excel. (c) Find the least-squares error E
1. Assume   α   is   opposite   side   a,   β   is   opposite   side   b,   and   γ   is   opposite  ...
1. Assume   α   is   opposite   side   a,   β   is   opposite   side   b,   and   γ   is   opposite   side   c.   Solve   each   triangle,   if   possible.   Round   each   answer   to   the   nearest   tenth.   a. ?=10,?=95°,?=30° b. ?=43.1°,?=184.2,?=242.8
1. Assume α is opposite side a, β is opposite side b, and γ is opposite...
1. Assume α is opposite side a, β is opposite side b, and γ is opposite side c. Solve the triangle, if possible. Round your answers to the nearest tenth. (If not possible, enter IMPOSSIBLE.) α = 36°, γ = 70°, a = 35 β = ° c = b = 2. Assume α is opposite side a, β is opposite side b, and γ is opposite side c. Solve the triangle, if possible. Round your answers to the nearest...
1. the number of new virions released from each bacterium host cell represent the _______. 2....
1. the number of new virions released from each bacterium host cell represent the _______. 2. "phage" attacks and multiple in __________.
1. the number of new virions released from each bacterium host cell represent the _______. 2....
1. the number of new virions released from each bacterium host cell represent the _______. 2. "phage" attacks and multiple in __________. 3. Freezing and drying for long term storage is known as ________. (hint! coffee is preserved that way as well). 4. the organelle _______ found in certain fungi, plugs the pores of hyphal cells to prevent materials from adjacent damaged cells to move to the healthy cell. 5. those hyphae responsible for anchoring the fungus into the substratum...
what do the numbers on the very left side of stem plot represent in ch 1...
what do the numbers on the very left side of stem plot represent in ch 1 prob 10AYK of the basic practice of statisitics (7ed)?
Problem 1: Discover the rule where a sequence of three number operates on. Problem 2 (code...
Problem 1: Discover the rule where a sequence of three number operates on. Problem 2 (code braking problem): Discover the rule of when the box opens. Assignment: Give a discussion of the two problems and how it was solved. What made each problem difficult and how it relates to the Gestalt psychology discussed in class
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT