300 likes | 418 Vues
This overview covers essential concepts in computer science related to strings and languages. It defines key terms such as strings, alphabets, and languages, providing examples like "cat" and "dog" to illustrate these concepts. The discussion includes string operations like concatenation, reversal, and substring extraction, along with various sets like prime and even numbers. Additionally, it introduces important operations on languages such as complement and closure, emphasizing their significance in computational problems.
E N D
Languages Costas Busch - RPI
Language: a set of strings • String:a sequence of symbols • from some alphabet • Example: • Strings: cat, dog, house • Language: {cat, dog, house} Alphabet: Costas Busch - RPI
Languages are used to describe computation problems: Alphabet: Costas Busch - RPI
Alphabets and Strings An alphabet is a set of symbols Example Alphabet: A string is a sequence of symbols from the alphabet Example Strings Costas Busch - RPI
Decimal numbers alphabet Binary numbers alphabet Costas Busch - RPI
Unary numbers alphabet Unary number: Decimal number: Costas Busch - RPI
String Operations Concatenation Costas Busch - RPI
Reverse Costas Busch - RPI
String Length • Length: • Examples: Costas Busch - RPI
Length of Concatenation • Example: Costas Busch - RPI
Empty String • A string with no letters is denoted: • Observations: Costas Busch - RPI
Substring • Substring of string: • a subsequence of consecutive characters • String Substring Costas Busch - RPI
Prefix and Suffix • Prefixes Suffixes prefix suffix Costas Busch - RPI
Another Operation • Example: • Definition: Costas Busch - RPI
The * Operation • : the set of all possible strings from • alphabet Costas Busch - RPI
The + Operation : the set of all possible strings from alphabet except Costas Busch - RPI
Languages • A language over alphabet • is any subset of • Examples: Language: Language: Language: Costas Busch - RPI
More Language Examples • An infinite language Alphabet Costas Busch - RPI
Prime numbers Alphabet Language: Costas Busch - RPI
Even and odd numbers Alphabet Costas Busch - RPI
Unary Addition Alphabet: Language: Costas Busch - RPI
Squares Alphabet: Language: Costas Busch - RPI
Note that: Sets Set size Set size String length Costas Busch - RPI
Operations on Languages • The usual set operations • Complement: Costas Busch - RPI
Reverse • Definition: • Examples: Costas Busch - RPI
Concatenation • Definition: • Example: Costas Busch - RPI
Another Operation • Definition: • Special case: Costas Busch - RPI
Star-Closure (Kleene *) • All strings that can be constructed from • Definition: • Example: Costas Busch - RPI
Positive Closure • Definition: Same with but without the Costas Busch - RPI