Professional Documents
Culture Documents
ICS141: Discrete Mathematics For Computer Science I
ICS141: Discrete Mathematics For Computer Science I
ICS141:
Discrete Mathematics for
Computer Science I
Dept. Information & Computer Sci., University of Hawaii
Jan Stelovsky
based on slides by Dr. Baek and Dr. Still
Originals by Dr. M. P. Frank and Dr. J.L. Gross
Provided by McGraw-Hill
Lecture 13
Chapter 2. Basic Structures
2.4 Sequences and Summations
= 6 ⋅10 = 60
! ! f (x, y) = ! ! f (x, y)
S( x ) T ( y) T ( y) S( x )
l n n l
! ! f (i, j) = ! ! f (i, j)
i=k j=m j=m i=k
expressions like:
k ∞
∑a
i= j
i ∑a
i= j
i ∑ f ( x)
x∈X
∑ f ( x)
P( x)
computer to understand,
n requiring only operations that the computer
precisely defined.
n Effectiveness. Individual steps are all do-able.
n Operands
n e.g., +, -, ^, and, or, not, …
n Types
n data are objects, each object has a specific type,
n Variables
n placeholders for data objects, whose values (and in
n Procedures
n parts of an algorithm that are defined ("declared")
n {comment}
n Not executed (does nothing).
n Natural-language text explaining some aspect of the procedure to
human readers.
n Also called a remark in some programming languages, e.g. BASIC.
n Example, as it may appear in a max program:
n {Note that v is the largest integer seen so far.}
n Comments should be well formulated, but terse!
n Better: {v is largest so far}
n More comments, less words, but more precise words
n Different languages use different syntax:
n # …, // …, /*several lines*/, …
if condition begin
statement
if condition begin
statement
…(continue infinite nested if’s)
end
end
begin
variable := initial
while variable ≤ final begin
statement
variable := variable + 1
end
end