## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### Chapter 12

#### Section 12.1

1. Consider the general algorithm that repeatedly cancels the same letter from each end of the input string by replacing its occurrences by Λ. A Turing machine program to accomplish this follows, where the start state is 0.

 (0, a, Λ, R, 1) Replace a by Λ. (0, b, Λ, R, 4) Replace b by Λ. (0, Λ, Λ, S, Halt) It's an even-length palindrome.
 (1, a, a, R, 1) Scan right. (1, b, b, R, 1) Scan right. (1, Λ, Λ, L, 2) Found the right end.
 (2, a, Λ, L, 3) Replace rightmost a by Λ. (2, Λ, Λ, S, Halt) It's an odd-length palindrome.
 (3, a, a, L, 3) Scan left. (3, b, b, L, 3) Scan left. (3, Λ, Λ, R, 0) Found left end. (4, a, a, R, 4) Scan right. (4, b, b, R, 4) Scan right. (4, Λ, ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required