what is the length of a language that contains epsilon?
1, I have an NFA that can recognize two words, "aa" and "epsilon". So the language L1 this NFA recognizes is a set {aa, epsilon}. What is the length of this language? Is |L1| = 1? or |L1| = 2?
2, Assuming I have another NFA 开发者_如何学Pythonthat can recognize one word "aa". So the language L will be a set {aa} In formal language, epsilon belongs to every language. Thus in fact L2 contains epsilon, that is a set {aa, epsilon} So what is the lenght of this language L2? 1 or 2?
Thanks
The length of a language is the cardinality of the set. Cardinality refers to how many elements the set contains. L1 contains two strings. Ergo...
Not every language contains epsilon. You're probably thinking of the "empty set" which is different from "epsilon", the "empty string". The size of the empty set is zero, and it is a subset of L2. The set containing only epsilon is of size one and is not a subset of L2. L2 contains one string, so it's length is...
精彩评论