Final Project Documentation: 1 Recurrence Relations/Dynamic Programming
Final Project Documentation: 1 Recurrence Relations/Dynamic Programming
Final Project Documentation: 1 Recurrence Relations/Dynamic Programming
Nashir Janmohamed
Due 11:59 pm, Monday, May 25
for n ≥ 0.
for n ≥ 0.
Their closed form is given by
2n 2n
−
n n+1
1
1.4 Stirling numbers of the first kind
1.5 Stirling numbers of the second kind
2
2.6 Generate all bit strings of length n
Given an integer n, all bit strings of length n can be recursively constructed by
appending a 0 and a 1 to all bit strings of length n − 1.
Thus, there are 2 ∗ (sn−1 ) bit strings of length n. Since there are 2 bit strings
of length 1, there are 2n bit strings of length n.
3 Relations
3.1 # of relations
A relation on an n element set S is a subset of S × S, or equivalently, an element
of the power set of S × S. There are
2
2|S||S| = 2n
such subsets.
(1) Generate all possible relations for an n element set (given by the power
set of the cartesian product of the set {1, 2, 3, . . . , n})
(2) For each relation generated in (1), check that for each (a, b), if there is a
point of the form (b, c), then (a, c) must be in the relation
reflexive relations. The argument for irreflexive relations is the same, with the
exception that all entries on the main diagonal of the matrix representation of
the relation must be 0.
3
n
all the 2 two element subsets (with distinct elements). Thus, there are
n n(n+1)
2( 2 )+n = 2 2
for n ≥ 0.
4
4 Sets
4.1 Generate power set
The power set of a set S is the set of all subsets of S, denoted by P(S). For
each element in S, it either is or is not in a subset of S, so there are two choices
for each element of S in each subset. Thus, there are 2|S| subsets of S.
5 Recurrence
5.1 Solve linear homogeneous recurrence relations with
constant coefficients (LHCCRRs)
A linear homogeneous recurrence relation with constant coefficients (LHCCRR)
of degree k is a recurrence relation of the form
an = c1 an−1 + c2 an−2 + · · · + ck an−k
where c1 , c2 , . . . , ck ∈ R and ck 6= 0. The characteristic equation (1) is
rk − c1 rk−1 − c2 rk−2 − . . . ck = 0
Suppose that (1) has t distinct roots r1 , r2 , . . . , rt with multiplicities m1 , m2 , . . . , mt ,
respectively, so that mi ≥ 1 for i = 1, 2, . . . , t and m1 + m2 + · · · + mt = k. Then
a sequence an is a solution of the recurrence relation if and only if
6 Isomorphisms
maybe total orders?
5
7 Default
No documentation provided.