The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+24 votes
The length of the shortest string NOT in the language (over $\Sigma = \{a, b\})$ of the following regular expression is _______.
asked in Theory of Computation by Veteran (101k points)
edited by | 2.1k views

4 Answers

+55 votes
Best answer

$R = a^*b^*(ba)^*a^*$

for finding shortest string that is not in language it is better to look strings of length $0$, then of length $1$ and so on 

$\text{length}0 \{ \epsilon \}$  is in $L$

$\text{length}1 \{a, b\}$      all belong to $L$

$\text{length}2 \{aa, ab, ba, bb\}$      all belong to $L$

$\text{length}3 \{aaa, aab, aba, abb, baa, bab, bba, bbb\}$  bab does not belong to L

answered by Veteran (55.1k points)
edited by

Praveen Saini  how did u get this?

0 length strings over {a,b} = $(a+b)^0= \epsilon$

1 length strings over {a,b} = $(a+b)^1=a,b$

2 length strings over {a,b} = $(a+b)^2= (a+b)(a+b)= aa,ab,ba,bb$.

so on

 @Praveen Saini why r  u not finding the language derived from R = a*b*(ba)*a* and complement it! can this be an approach ?


yes that is same thing, you can find language of R, L(R), then complement, L'(R), then first element of L(R') will be bab.

Good Explanation

@praveen Saini .i didn't get that approach compliment one .can u please elaborate!!!!!!!!!

although i understand the given
Please draw once then explain m not getting how to solve this???
+9 votes

The big give away is the concatenation (ba)*  followed by a*

answered by Junior (853 points)
+7 votes
the shortest length is 3.

answer:- "bab"
answered by Boss (19.7k points)
+5 votes
To be completely sure of the right answer, construct an ɛ-NFA for the given language, convert it into an equivalent DFA and then complement it. The answer comes out to be bab.
answered by Active (1.4k points)
@Vishal please explain with Diagram ..

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,440 questions
46,623 answers
57,020 users