CIS 320
Homework Assignment 1
Due: September 21st
1. Compare the two functions - log2 n and
answer.
n and decide their asymptotic relationship. Prove your
2. For each of the following statements, either prove that the statement is true for all positive-va
CIS 320
Homework Assignment 2
Due: October 5 th
1. An inversion in an array A is a pair of indices i < j such that A[i] > A[j]. Show how you can modify
MergeSort to find the number of inversions in a given input array in O(n log n) time.
2. Consider the f
CIS 320
Homework Assignment 3
Due: October 26 th
1. Suppose we want to maintain a splay tree for a set of elements S. In addition to the usual operations
of insert, delete, and find, we want to support one other operation rank(x), which should return
the
Lecture 7 notes
'I. HAMHTONIAN PATH SATISFIAHHJTV
o HAMIIJTIONIAN PATH
Input
>:=: Graph G = 1: t'", E}
YeslflVe Question
>:=: Does there exist a Hamiltonian lath [a path that visits each node exactly
(nice) in G?
o SATISFIABILITY
Input
Set of
Lecture ll]I
Dynamic Programming
Shortest Taths, Chained hrlatrix \lultiplieaticm
All Pairs Shortest Path Problem
Tnput: Edge 1Weighted Graph G (VJ-7.; weight Funeti on we) on each edge
Task: Compute the length of the shortest path from every node i t
Midterm 1
Cheat Sheet
Logarithm/Exponent Rules
- 10gi(xy)= lost 36+ lost... .v
Note: The rule does not. apply to loga (x + y). A way to bound loge (x + y) would be to use
the following relationship:
logt (35+ y) 5 legs (21nax(x._ )0)
= loga 2 + logs I
CIS 320: Algorithms - Fall 2016
Proving lower bounds
For any computational problem there are many different (often infinitely many) algorithms that
solve the problem. To prove an upper bound of f (n) for the problem we need to show that there is
an algori