This preview shows pages 1–3. Sign up to view the full content.
Sequences or strings of symbols and characters are fundamental in computer science.
We use strings of symbols to represent data and most importantly we use them to
represent algorithms.
We formalize these structures as follows:
An
alphabet
is any nonempty, finite set. The elements of an alphabet are called
symbols
.
Examples:
Σ=
{
0
,
1
}
Σ
0
=
{
a, b, c, d
}
Γ=
{
this,and,that
}
A
string over an alphabet
is a finite sequence of symbols from that alphabet.
Example:
Given the alphabet
Σ=
{
0
,
1
}
then the following are strings over this alphabet:
011001
,
000000
,
1
.
–p
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document Operations on
Strings
If
w
is a string over
Σ
, then the
length
of
w
, written

w

, is the number of symbols
w
contains.
The
empty string
, usually written as
±
, is a string where

±

=0
.
Given a string
w
of length
n
, we can write
w
=
w
1
w
2
...w
n
where
w
i
∈
Σ
.
Furthermore, we can define the
reverse
of
w
by
w
R
=
w
n
w
n
−
1
...w
1
.
Some string
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 10/03/2011 for the course CSC 544 taught by Professor Staff during the Spring '11 term at Rhode Island.
 Spring '11
 Staff
 Algorithms

Click to edit the document details