This preview shows pages 1–2. Sign up to view the full content.
COP 3503 – Computer Science II
–
CLASS NOTES

DAY #11  Supplement
“Sorting” – What does it mean?
Many times the question arises as to how the theory covered in discrete structures
courses (COT 3100 at UCF) applies to various areas in Computer Science.
We can use
sorting as an easy example to illustrate the connection.
We have dealt with several
different sorting techniques in the last couple of days of class and frequently made
mention of the fact that we want to sort the numbers in our arrays in ascending order.
While it may be clear to us what we mean by such a statement, it is far cry from a
precise statement.
If we are to analyze sorting algorithms with any mathematical rigor
a much more mathematically precise definition must be formulated.
The following
paragraph or two will give you a flavor of the mathematical precision that is required
to do the job correctly.
For those of you already familiar with discrete structures this
should look familiar, for those of you who haven’t had that pleasure yet, hang on
you’re in for quite an experience at some point.
Consider a arbitrary sequence
S = {s
1
, s
2
, s
3
, …, s
n
}
composed of
n
≥
0
elements drawn
from a universal set
U
.
The goal of sorting is to rearrange the elements of
S
to produce
a new sequence, say
S’
, in which the elements of
S
appear in order.
What does it mean
to
appear in order
.
We will assume that there exists a
relation
<
, defined over the
universe
U
.
The relation < must be a
total order.
A total order is defined as:
A
total order
is a relation, say <, defined on the elements of some
universal set
U
with the following properties:
1. For all pairs of elements
(i, j)
∈
U
×
U
, exactly one of the
following is true:
i < j, i = j,
or
j < i
.
(All elements are commensurate.)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.