The Answers for Homework - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

The Answers for Homework

Description:

1-1. The TM is similar to the copier in example #2. The only difference is in ... TM can be seen as a repeated copier of the current content between the two 0's ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 9
Provided by: cisKHo
Category:

less

Transcript and Presenter's Notes

Title: The Answers for Homework


1
The Answers for Homework 11
  • 1-1. The TM is similar to the copier in example
    2. The only difference is in step 3 instead of
    create a 1, we create 11.
  • 1-2. The TM contains 3 stages
  • Stage 1 copy x to its left-side (x ? 2x)
  • Stage 2 use the TM in 1-1 for y (y ?3y)
  • Stage 3 use the adder TM.

2
The Answers for Homework 11
  • 1-3. The TM program can be divided into the
    following 3 parts
  • Part I find the rightmost 1s (up to 5 1s)

3
The Answers for Homework 11
  • Part II if there are 5 1s then remove them.

4
The Answers for Homework 11
  • Part III Halting process (go to final state q12
    if there are less than 5 1s left).

5
The Answers for Homework 11
  • 2-1. Assume the initial and final tape contents
    are 010n and , respectively.
  • The TM can be seen as a repeated copier of the
    current content between the two 0s for each 1 in
    n (0m0 ? 02m0). The pseudo-code of the TM
    program is shown below

6
The Answers for Homework 11
  • Step 1 repeat the following until n contains no
    more 1s
  • - find a 1 in n and replace it with symbol a
  • - copy m in 0m0 (0m0 ? 02m0)
  • Step 2 replace all as with 1s

7
The Answers for Homework 11
  • 2-2. Assume the initial and final tape contents
    are 010n and 0n!0n, respectively.
  • The TM can be seen as a repeated multiplier of
    the current content between the two 0s with the
    current number following the 2nd 0 (0x0yaa ?
    0xy0yaa). The pseudo-code of the TM program is
    shown below

8
The Answers for Homework 11
  • Step 1 replace all 1s in n by as
  • Step 2 repeat the following until n contains no
    more as
  • - replace the leftmost a by 1
  • - replace x in 0x0 by xy (0x0yaa ? 0xy0yaa).
Write a Comment
User Comments (0)
About PowerShow.com