程序代写代做代考 1

1
Why one should reset the noninput variables of M if it is used more than once in a program.
Consider the URM Mxz ¡ªthat is, URM with input/output choice as shown¡ª below:
1: x¡ûx+1 2: x¡ûx+1 3: z¡û0
4: stop
Here Mxz = ¦Ëz.2.
What happens if we stack two copies of M on top of each other? Let¡¯s choose the same I/O variables.
1: 2: 3: 4: 5: 6: 7:
We obtain, Nxz below:
x¡ûx+1 x¡ûx+1 z¡û0 x¡ûx+1 x¡ûx+1 z¡û0 stop
Note that Nxz = ¦Ëz.4. This is odd given that N is
M
M
and each M separately computes ¦Ëz.2.
What happened?
The bottom M does not work as expected! WHY?
Because the noninput variable (x) of the second M was NOT set to 0. The second M starts off with initial value for x equal to
2.
EECS 2001Z. George Tourlakis. Winter 2019