Week 1 - Strings and Languages Flashcards

1
Q

What is the definition of ‘alphabet’ in computing?

A

A finite and non-empty set of symbols.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a member of an ‘alphabet’ called?

A

A symbol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In computing, is ‘alphabet’ just the normal alphabet?

A
No, it can be any set of symbols.
Examples:
{0, 1}
{a, b, c, ..., x, y, z}
{0, 1, a, b, +, =, @, #}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a string/word?

A

A sequence of symbols from a given ‘alphabet’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an empty string?

A

A string containing no symbols. This can be formed from any ‘alphabet’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is another name from the empty string? Another way to represent it?

A

ε (Aka: Epsilon).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do we normally denote the length of word w for example?

A

|w|
some examples
|waterhorn| = 9
|dice| = 4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do we normally denote the reverse word of word w?

A

w^R
e.g.
dice^R = ecid
abc^R = cba

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a substring?

A

A sequence of symbols that can be directly found as part of a string/word in the exact order specicified in the substring.
e.g.
water and horn are substrings of waterhorn.
a, b, c, ab and bc are all substrings of abc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a prefix?

A

It is a substring that is found on the leftmost side of a word.
e.g.
‘water’, ‘wa’ and ‘waterho’ are prefixes of ‘waterhorn’.
‘a’, ‘ab’ and ‘abc’ are prefixes of ‘abc’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

TRUE OR FALSE: Can ε count as a prefix/suffix for a word.

A

TRUE, because all words can technically start with nothing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

TRUE OR FALSE: A word can count as a prefix/suffix for itself.

A

TRUE, because a substring is just any ordered seqeunce found within a word.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a suffix?

A

It is a substring that is found on the rightmost side of a word.
e.g.
‘horn’, ‘rn’ and ‘aterhorn’ are suffixes of ‘waterhorn’.
‘c’, ‘bc’ and ‘abc’ are suffixes of ‘abc’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is concatentation?

A
Appending together words/strings, so that at the end of a word another word starts.
e.g.
w = waterhorn and z = abc
wz = waterhornabc
zw = abcwaterhorn
zwz = abcwaterhornzbc
wwww = waterhornwaterhornwaterhornwaterhorn
etc..
z^2 = zz = abcabc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

TRUE OR FALSE: If z is a prefix of word w, then there must exist a string u in the same alphabet such that w = zu.

A

TRUE.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

TRUE OR FALSE: If z is a suffix of word w, then there must exist a string u in the same alphabet such that w = uz.

A

TRUE.

17
Q

What is the lexicographic order?

A

The ORDERED set of strings for a given alphabet.

18
Q

How is the lexicographic order ordered?

A

Using the alphabetical order to do with a given alphabet, assuming that alphabet can be ordered.