Partial preview of the text
Download Alphabet, Strings and Languages and more Assignments Theory of Computation in PDF only on Docsity!
Week 01 Date: 06 August 2025 Course: Theory of Computation Problem Set Questions 1. Alphabet and String Definition Given the alphabet & = {a, b}, list all possible strings of length 3 that can be formed over this alphabet. How many such strings of length 3 can be formed over = = {a, b}? What is the total number of strings of length <= 3 over the alphabet = = {a, b}? List all strings of length 3 over = = {a, b} that contain exactly two a’s. How many strings of length 3 contain at least one ‘b’? How many strings of length 3 start and end with the same character? oa PF eON DS Find all strings of length 3 over 2 that do not contain two consecutive b’ 2. String Length and Empty String For the alphabet 2 = {0, 1, 2}: 1. What is the length of the string "0120"? 2. What is the empty string ¢ and what is its length? 3. List all strings of length 0, 1, and 2 over 2. 3. String Concatenation Given strings w: = "ab", w2 = "ba", and ws = "a" over alphabet = = {a, b}: 1. Calculate wiw2 (concatenation of wi and wz). 2. Calculate w2wswi. 3. Is string concatenation commutative?. 4. Prefixes and Suffixes For the string w = "abab" over alphabet = = {a, b}: 1. List all prefixes of w (including the empty prefix). List all suffixes of w (including the empty suffix). Identify which strings are both prefixes and suffixes of w. € is a prefix of every string. (True/False) Every suffix is also a substring. (True/False) A string can be its own prefix. (True/False) NO aPWN Inw = abba, the string bb is a prefix. (True/False) 5. String Reversal and Palindromes Given the alphabet = = {x, y}: 1. Find the reverse of the string "xyyx". 2. Determine which of these strings are palindromes: "x", "xy", "xyx", "xyyx". 3. Construct two different palindromes of length 5 over z. 6. Substrings and String Containment For the string s = “ababa" over alphabet 2 = {a, b}: 1. List all substrings of length 2. Given the alphabet = = {a, b} with ordering a < b: 1. Arrange these strings in lexicographic order: "b", "ab", "aa", "ba", "a", "bb". Week 01 Practices: Discussions