r/AskComputerScience • u/Quick-Fee-3508 • Feb 11 '26
Doubt regarding Theory of Computation
So our college just started with the course of Theory of Computation and here's the question that I'm confused about:
Q) Find regular expression for the language of all string that starts with aab over alphabet Σ = {a,b}. My answer was (aab)* (a|b)*
Now I do know that the expression (aab)* also includes null string but what if we assume it doesn't include the Null String then an answer like aabaab can also be valid
Considering string "aabaab" also starts with "aab"
9
Upvotes
View all comments
Show parent comment
1
u/Objective_Mine MSCS, CS Pro (10+) Feb 12 '26
Yes, exactly.
I mentioned (aab)+(a|b)* because that would actually be the "(aab)* but not including the empty string" that you mentioned in the post.
But it's really better to just make it (aab)(a|b)*.