• retagged by
10,090 views
4 4 votes
The possible number of prefixes for the given 'n' length string is (assume all symbols in the given string are different)

a) n

b) n+1

c) n+2

d) n-1

please explain.

6 Answers

1 1 vote
Let's take a string=gate.Now the prefixes possible are:
{g,ga,gat,gate,epsilon}=5=N+1
Similarly suffixes are:{epsilon,gate,ate,te,e}=5=N+1.
1 1 vote
Consider the string 011 over the binary alphabet. All the prefixes, suffixes, and substrings of this string are listed below.

Prefixes: $\varepsilon$, 0, 01, 011.
Suffixes: $\varepsilon$, 1, 11, 011.
Substrings: $\varepsilon$, 0, 1, 01, 11, 011.

Note that x is a prefix (suffix or substring) to x, for any string x and $\varepsilon$ is a prefix (suffix or substring) to any string.

A string x is a proper prefix (suffix) of string y if x is a prefix (suffix) of y and $x\neq y$

In the above example, all prefixes except 011 are proper prefixes.
0 0 votes
N+1 as it will contain {ɛ,a,ab,abc}
0 0 votes
Answer is  b option

Suppose ab is string

Then prefix is {€, a, ab}

Hence answer is n+1
Position:
Show:

Related questions

1 1 vote
1 1 answer
79
79 views
GO Classes asked Sep 11
79 views
For $L=\{w\in{a,b}^* \mid n_a(w)=2n_b(w)\}$, which invariant should a PDA maintain using stack symbols $A$ and $B$ for surplus?$n_a(\text{read})-2n_b(\text{read})=\#A-\#B...
1 1 vote
1 1 answer
76
76 views
GO Classes asked Sep 11
76 views
Let $L=\{x?y \mid x,y\in{0,1}^*$ and $y=x^R\}$. Which of the following strings belong to $L$?$01?10$ $01?01$ $10?01$ $110?110$ $?$
1 1 vote
1 1 answer
81
81 views
GO Classes asked Sep 11
81 views
For the language $L=\{w\in{a,b}^* \mid n_a(w)=n_b(w)\}$, which statements describe a correct PDA design idea?Use the stack to store the currently unmatched majority symbo...
0 0 votes
1 1 answer
90
90 views
GO Classes asked Sep 10
90 views
Let $L=\{w\in{a,b}^*\mid w$ has even length and $w$ is not a palindrome$\}$. Which PDA idea correctly recognizes $L$?Push the first half of the input, nondeterministicall...