Issues in a VoIP Network
There are several issues that need to be addressed in order to provide a toll-quality, PSTN equivalent end-to-end VoIP network. These include: Service set to be offered, and the types of end user terminal supported. 1. Choice

Problems: what to do with deletes?
Ex: suppose we delete the key at location 3
if we put NIL at location 3 and
later do a search for key[x],
well conclude key[x] is not in the table
need to keep a special marker for free slots
that used to have something

Tree-Delete(T,z)
case 1: z has no children
set p[z]s pointer to NIL instead of z
case 2: z has 1 child
set p[z] to point at zs child
case 3: z has 2 children
recursively delete zs successor y and put y in zs place
if left[z]=NIL or right[z]=NIL then y=z
e

4) develop new operations
Interval-Search(T,i)
x=root[T]
while x NIL and i does not overlap int[x]
if left [ x ] NIL and max [ left [ x ] ] low [ i ] then x=left[x]
else x=right[x]
Theorem: 1) if search goes right,
then xs left subtree contains no interva

Path-Compression
during Find-Set, make each node on the nd path point
directly to root
c
c
h
b
a
e
i
t
h
i
b
s
Using union by rank and path compression:
O(m(m,n) running time for m+n operations
(m,n) is a function that is almost constant
(for any conceiva

Lemma: Let T be an optimal prex code over alphabet C.
Consider any two characters x and y that appear as sibling
leaves in T and let z be their parent. Then, the tree T=T-cfw_x,y
is an optimal prex code over alphabet C=C-cfw_x,y+cfw_z
where the frequency

Recursive solution for nding LCS of X and Y
if xs=yt, then nd an LCS of Xs-1 and Yt-1, and then append xs=yt to this LCS
if xs yt, then solve two subproblems:
(1) nd an LCS of Xs-1 and Y; (2) nd an LCS of X and Yt-1;
whichever of these two LCSs is longer

Dynamic-0-1-Knapsack
for w=0 to L
c[0,w]=0
for i=1 to n
c[i,0]=0
for w=1 to L
if w [ i ] w then
if v [ i ] + c [ i 1, w w [ i ] ] > c [ i 1, w ]
then c[i,w]=v[i]+c[i-1,w-w[i]
else c[i,w]=c[i-1,w]
else c[i,w]=c[i-1,w]
Running time: O(nL)
Dynamic programmin

Analysis:
loop 1 takes (n)
if input elements are random numbers in the interval [0,1),
then each bucket expects to get O(1) values,
then each run of insertion sort takes (1) time
T(n) = (n) time
What if input element are numbers that arent random?
all the

Lower bound for sorting
if the only operations allowed on the input numbers is comparisons
then such an algorithm must take at least (n lg n) time
All the algorithms we saw so far use only comparisons
If we do not have any information about the kinds of v

This homework assignment is d ue exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show ALL WORK for full credit.
1. (10 pts total) Consider the following procedure:
Algorithm

This homework assignment is d ue exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show ALL WORK for full credit.
1. (10 pts total) Using the definition of Big O, prove Theorem

CS435 Homework Assignment 3
This homework assignment i s d ue exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly wr itten sheet and show A LL WORK for full credit.
For questions 1-8 you are given

CS435 Homework Assignment 4
This homework assignment i s d ue exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show A LL WORK for full credit.
For questions 1-12 you are given

CS610 Homework Assignment 5
This homework assignment i s d ue exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show A LL WORK for full credit.
1. (15 points total) Implement t

CS610 Homework Assignment 6
This homework assignment i s d ue exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show A LL WORK for full credit.
1. (5 points total) Following th

This homework assignment i s due exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show ALL WORK for full credit.
More Singly Linked List Processing Algorithms
For problems 1 a

This homework assignment i s due exactly one week after being assigned unless otherwise specified. Attach answers on a
separate typed or neatly written sheet and show ALL WORK for full credit.
Doubly Linked List Processing Algorithms
For problems 1 and 2

In this course, we will be interested in the worst-case running time
because
1) it is an upper bound on running time for any input
2) it often happens frequently
3) average case is often roughly as bad as the worst case
Problems with average case analysis

Detail: when do we not recurse anymore?
when subarray has size 1
Running time for input of size n is T(n)
p=1, r=n
Mergesort(A,p,r)
if p<r then q =
p+r
-2
Mergesort(A,p,q)
Mergesort(A,q+1,r)
Merge(A,p,q,r)
(1)
T( n )
-2
T( n )
-2
(n)
Running time for an i

Lecture 3: Solving Recurrences
Mergesort had running time T(n)=T( n ) + T( n ) + (n) + (1)
-2
2
What is it equal to? i.e. the closed form
n
If a recurrence is of the form T ( n ) = aT - + f ( n ) and T(1) = (1)
b
then often an easy recipe applies
Master