Dynamic programming is a mathematical technique often
useful for making a sequence of interrelated decisions. It pro-
vides a systematic procedure for determining the combination
of decisions that maximizes overall effectiveness.
In contrast to linear pro
Solution #1:
1. The following pairs are compatible: cfw_O, , cfw_O, , cfw_ , :Choose f (n) =
g(n)
Any pair such that f(n) = o(g(n) also satises f (n) = O(g(n) since
[f (n) = o(g(n)] [limn [ f (n) ] = 0] [limn [ f (n) ] < ]
g(n)
g(n)
So this pair cfw_o, O
Assignment #1: Due First Class in September
1. Which pairs of statements of the type f (n) = A(g(n) are incompatible? Here A cfw_, , O, , o. Prove your statements or give counter examples for each pair. 2. Does the statement [f(n) = O(g(n)] imply the stat
GROUP FORMATION : CS 6363-004
The following rules apply for assignments:
1. Students are permitted to submit assignments in groups ; this is not
required but optional.
2. All groups will consist of at least four and no more than five students.
3. Instruct
Assignment #2:
Due September 11
1. Exercises 4.3-6, 4.3-9
2. Exercises 4.4-2, 4,4-6
3. Problem 4-3: (b),(c), and (f)
4. Problem 4-4 (page 108)
5. (Challenge Problem Need not be turned in and solution will not be
provided): Consider Case 3 of master theore
Assignment #7 Not to be turned in 1. 34-1: (a),(b) 2. 34.5-2 3. 34.5-5 4. 34.1-6: do union, intersection, complementation, and concatenation. 5. 34.2-9
1
FV 767<
334
Vroxwlrqv
iru
H[DP&4
IDOO 5333
U= Fkdqgudvhndudq
41 Zkloh frpsdulqj ixqfwlrqv vxssrvh zh xvh wkh dqdorj| wr frpsdulvrq ri wzr qxpehuv= ixqfwlrqv qxpehuv i +q, @ R+j+q, d e i +q, @ r+j+q, d ? e i +q, @ +j+q, d e i +q, @ $+j+q, d A e i +q, @ +j+
Solution #3:
1. An unsorted array A[1, 2, ., n] contains all the integers 0 to n except
one. It would be easy to determine the missing integer in O(n) time by
using an auxiliary array B[0, 1, ., n] to record which numbers appear in
A[1, 2, ., n]. In this
Assignment #6:
1. 23.1-2; 23.1-3; 23.1-4 Solutions: 23.1-2: The set A are the blue edges; edge (u, v) is the red edge. The cut is marked in blue.
4
A
B
8 2
D
E
7 4
G
9 14 10
H I
11 7 8
C
6
F
1
2
23.1-3: When an edge of a spanning tree is removed from the
CS 6363 - EXAM #2 - Group
FALL
2011
R. Chandrasekaran
Solve any one of the two problems. Give reasons and show enough work to convince the reader that you know what you are doing. Good Luck.
1. (10 points) We are given an unsorted array A[1, 2, ., n] of
Assignment #1:
Due September 4
1. A pair of symbols A, B cfw_, , O, , o is said to be incompatible if
there exist no functions f(n), g(n) that satisfy both relations [f (n) =
A(g(n)]&[f(n) = B(g(n)]. Which pairs of statements of the type [f (n) =
A(g(n)]&
Assignment #4:
Due: October 16
Proofs or counter-examples absolutely necessary for this assignment!
1. Let G = [V, E] be an undirected graph. We want to check if it is connected.
The only questions that we are allowed to ask are of the form: "Is there
an
CS 6363 - SAMPLE - EXAM Instructions:
SPRING
2007
R. Chandrasekaran
This is a closed book examination. You must do AT LEAST ONE of cfw_#4,#5,#6 and an additional set of problems adding up to 45 points. Give reasons and show enough work to convince the re
Assignment #4:
1. At any stage of an algorithm there will be three types of edges: E1 is the set of pairs of nodes for which the the algorithm designer has asked the question and the answer given by the adversary was YES - these edges are already present
Assignment #4: October 2/3 Proofs or counter-examples absolutely necessary for this assignment! 1. Let G = [V, E] be an undirected graph. We want to check if it is connected. The only questions that we are allowed to ask are of the form: "Is there an edge
Lecture 16
Maximum Matching
Incremental Method
Transform from a feasible solution to
another feasible solution to increase (or
decrease) the value of objective function.
Matching in Bipartite Graph
Given a bipartite graph G (V ,U , E ), a matching is a s
Lecture 16
Max Flows 3
Preflow-Push Algorithms
Review
The Ford Fulkerson Maximum Flow Algorithm
Begin x := 0;
create the residual network G(x);
while there is some directed path from s to t in G(x)
do
begin
let P be a path from s to t in G(x);
:= (P);
sen
Lectures 18-19
Linear Programming
Preparation
Linear Algebra
Linearly Independent
Vectors a1 , a2 ,., an are linearly independen t if
1a1 2 a2 n an 0 1 2 n 0.
Vectors a1 , a2 ,., an are linearly dependent if
there exist scalers 1 , 2 ,., n , not all equal
Lecture 19-Problem Solving 4
Incremental Method
Min Spanning Tree
Minimum Spanning Tree
Could you design an incremental method
with the path optimality condition?
Could you design an incremental method
with the cut optimality condition?
What is the run
Lecture 13
Introduction to Maximum
Flows
Flow Network
A flow network G (V , E ) is a directed graph in which each
edge ( x, y ) E ha a nonnegative capacity u ( x, y ) 0.
For ( x, y ) E , assume u ( x, y ) 0.
We distinguish two nodes : a source s and a sin
CS 6363.005: Algorithms
Fall 2014
Assignment 3
Sep 29, 2014
Assignment is due at 2:30 PM on Mon, Oct 13, in class.
1. Ex. 15.1-3 (page 370).
Consider a modification of the rod-cutting problem in which, in addition
to a price p_i for each rod, each cut inc
Implementation of Dijkstras Algorithm
Dijkstras Algorithm
Define d (u ) min
cfw_d * (v) c(v, u ) for u T .
vN ( u ) S
Initially, S cfw_s, T V S .
In each iteration, find u T : d (u ) min d ( w).
wT
S S cfw_u
T T cfw_u
update d ( w) for w T ;
Stop if T .
I
Unit 1. Sorting and
Divide and Conquer
Lecture 1 Introduction to
Algorithm and Sorting
What is an Algorithm?
An algorithm is a computational procedure
that takes some value, or a set of values,
as input and produces some values, or a
set of values, as ou
Lecture 7
All-Pairs Shortest Paths
All-Pairs Shortest Paths
Given a digraph G (V , E ), find shortest
path from s to t for all pairs cfw_s, t of nodes.
Path Counting Problem
Given a digraph G (V , E ) and a positive
integer k , count # of paths with exact
Lecture: Priority Queue
Questions
Is array a data structure?
What is a data structure?
No! Why?
It is a standard part of algorithm
What data structures are implemented by
array?
Stack, Queue, List, Heap, Max-heap, Min-heap,
Priority queue (max -, min
Lecture 3
Sorting and Selection
Comparison Sort
In a comparison sort, we use only comparisons between
elements to gain order informatio n about input sequence
cfw_a1 , a2 ,., an .
Insertion Sort, Merge Sort, Heapsort and Quicksort are
comparison sorts.
Ea
Assignment #4:
Due: October 10
Proofs or counter-examples absolutely necessary for this assignment!
1. Let G = [V, E] be an undirected graph. We want to check if it is connected.
The only questions that we are allowed to ask are of the form: "Is there
an
Assignment #1:
Due August 31
1. Suppose f(n) = O(g(n) and f(n) = o(g(n), is the statement that f (n) =
(g(n) true? If your answer is yes, prove it; if it is no, provide a counter
example.
2. Does the statement [f(n) = O(g(n)] imply the statement [2f (n) =
Assignment #3:
Due September 14
Please keep a copy with you!
1. Show switch settings for the following using the algorithm described in
class: Show the settings for all switches.
1
8
2
N1
n=4
3
7
6
4
2
5
1
6
N2
n=4
7
8
4
3
5
n=8
2. Problem 4-5
3. Problem
Solution #1:
(n)
(n)
1. If limn [ fg(n)
] exists, then [f(n) = O(g(n)] limn [ fg(n)
] < ;
(n)
] > 0. Hence in this case, it is
morevoer, [f(n) = o(g(n)] limn [ fg(n)
true that f(n) = (g(n).
If we assume that both these functions are nonnegative, increasin
Assignment #2:
Due September 7
1. Exercises 4.3-6, 4.3-9
2. Consider the recurrence relation that looks like:
n
2n
t(n) = t( ) + t( ) + n
3
3
t(1) = (1)
(a) Using recursion tree, show that t(n) = (n lg n)
(b) Using substitution method show that t(n) = O(n