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
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
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 #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
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
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+
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 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
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 #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
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
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)]&
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
CS 6363.005: Algorithms
Fall 2014
Assignment 1
Sep 4, 2014
You can write or type your answers. Do not discuss the problems in
assignment with anyone, except the instructor. Assignment is due
at 2:30 PM on Mon, Sep 15, in class.
Due: Mon, Sep 15 (in class)
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 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
CS 6363.005: Algorithms
Fall 2014
Assignment 2
Sep 16, 2014
Assignment is due at 2:30 PM on Mon, Sep 29, in class.
1. Problem 9-1 (page 224).
[Largest i numbers in sorted order]
2. Problem 9-2, parts a-c (page 225).
[Weighted median]
3. Read Counting Sort
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
Solution to Assignment #2:
1. (4.3-6) Show that t(n) = O(n lg n) for the relation:
t(n) = 2t(
n
+ 17) + n
2
Solution: Let m = n 34. This implies that
our equation becomes:
n
2
+ 17 =
m
2
+ 34. Hence
m
+ 34) + (m + 34)
2
m
s(m) = 2s(
) + (m)
2
= (m lg m)
t
Lecture 24
Vertex Cover and Hamiltonian Cycle
Vertex Cover
Given a graph G=(V,E), find a minimum
subset C of vertices such that every edge
is incident to a vertex in C.
Decision Version
Given a graph G=(V,E) and positive
integer k < |V|, is there a vert
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
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
LR Parsing table for the following context-free grammar:
Production Rules 0-6: E ' E , E E+T , ET ,
State
+
*
(
0
)
T TF ,
id
S4
$
S5
1
S6
2
R2
S7
R2
R2
3
R4
R4
R4
R4
S4
R6
F( E),
F id .
E
T
F
1
2
3
8
2
3
9
3
accept
4
5
T F ,
R6
S5
R6
R6
6
S4
S5
7
S4
S5
1
c Balaji Raghavachari
119
Algorithm Design and Analysis
c Balaji Raghavachari
151
Algorithm Design and Analysis
Illustration of Human coding algorithm
Characters cfw_a, b, c, d, e with frequencies cfw_0.2, 0.1, 0.15, 0.3, 0.25
(a)
a:0.2
b:0.1
c:0.15
d:0.
c Balaji Raghavachari
1
Implementation of ADSA
c Balaji Raghavachari
2
Implementation of ADSA
Computing x
n
Naive algorithm for computing xn (RT: O(n):
naivePower(x, n, p) / Return xn modp
prod 1
for i 1 to n do
prod (prod x)%p
return prod
DAC algorithms