Pack
CS-6515 Algorithms latest already passed
CS-6515 Algorithms latest already passed
[Montrer plus]CS-6515 Algorithms latest already passed
[Montrer plus]Aperçu 1 sur 3 pages
Ajouter au panierCS6515 Midterm Review questions and answers
DFS outputs - ANSWER-pre array, post array, ccnum array, prev array 
BFS outputs - ANSWER-dist array, prev array 
Explore outputs - ANSWER-visited array. 
When to use Dijkstra's? - ANSWER-Works for both directed and undirected 
graphs. Must have only non-negative edge weights. 
Dijkstra's outputs ...
Aperçu 1 sur 3 pages
Ajouter au panierDFS outputs - ANSWER-pre array, post array, ccnum array, prev array 
BFS outputs - ANSWER-dist array, prev array 
Explore outputs - ANSWER-visited array. 
When to use Dijkstra's? - ANSWER-Works for both directed and undirected 
graphs. Must have only non-negative edge weights. 
Dijkstra's outputs ...
Aperçu 2 sur 8 pages
Ajouter au panierCS6515 Exam 3 questions and answers
CS6515 Exam 3 Study Guide questions and answers
Aperçu 1 sur 4 pages
Ajouter au panierCS6515 Exam 3 Study Guide questions and answers
Weak Duality Theorem 
Feasible x <= Feasible y where c^(zT) x <= b^(T) y. Here c^(T) means transpose and 
same for b^(T). 
Weak Duality Theorem Corollary 1 
If Feasible x = Feasible y, they are optimums c^(T) x^(asterisk) = b^(T) y^(asterisk) . 
Weak Duality Theorem Corollary 2 
If Primal/Dual...
Aperçu 2 sur 7 pages
Ajouter au panierWeak Duality Theorem 
Feasible x <= Feasible y where c^(zT) x <= b^(T) y. Here c^(T) means transpose and 
same for b^(T). 
Weak Duality Theorem Corollary 1 
If Feasible x = Feasible y, they are optimums c^(T) x^(asterisk) = b^(T) y^(asterisk) . 
Weak Duality Theorem Corollary 2 
If Primal/Dual...
Basic Properties of Trees - ANSWER-Tree's are undirected, connected and 
acyclic that connect all nodes. 
1. Tree on n vertices has (n-1) edges -> would have a cycle otherwise (more than 
n-1 edges means cycle) 
2. In tree exactly one path between every pair of vertices (otherwise it's not 
con...
Aperçu 2 sur 11 pages
Ajouter au panierBasic Properties of Trees - ANSWER-Tree's are undirected, connected and 
acyclic that connect all nodes. 
1. Tree on n vertices has (n-1) edges -> would have a cycle otherwise (more than 
n-1 edges means cycle) 
2. In tree exactly one path between every pair of vertices (otherwise it's not 
con...
CS6515 Exam 2 Questions and answers 
If graph G has more than |V | − 1 edges, and there is a unique heaviest edge, 
then this edge cannot be part of a minimum spanning tree - ANSWER-False, 
because the unique heaviest edge may not be part of a cycle 
If G has a cycle with a unique heaviest edge e,...
Aperçu 1 sur 4 pages
Ajouter au panierCS6515 Exam 2 Questions and answers 
If graph G has more than |V | − 1 edges, and there is a unique heaviest edge, 
then this edge cannot be part of a minimum spanning tree - ANSWER-False, 
because the unique heaviest edge may not be part of a cycle 
If G has a cycle with a unique heaviest edge e,...
Knapsack without repetition - ANSWER-k(0) = 0 
for w = 1 to W: 
if w_j >w: k(w,j) = k(w, j - 1) 
else: K(w,j) = max{K(w, j -1),K(w - w_j, j -1) + v_i} 
knapsack with repetition - ANSWER-knapsack repeat(w_i....w_n, w_i... w_n, B) 
k(0) = 0 
for i = 1 to n 
if w_i <= b & k(b) <v_i + K(b-w_i) ...
Aperçu 2 sur 10 pages
Ajouter au panierKnapsack without repetition - ANSWER-k(0) = 0 
for w = 1 to W: 
if w_j >w: k(w,j) = k(w, j - 1) 
else: K(w,j) = max{K(w, j -1),K(w - w_j, j -1) + v_i} 
knapsack with repetition - ANSWER-knapsack repeat(w_i....w_n, w_i... w_n, B) 
k(0) = 0 
for i = 1 to n 
if w_i <= b & k(b) <v_i + K(b-w_i) ...
In a DAG, what makes a pair of vertices strongly connected? - answer-There is a 
path `V→W` and `W→V` 
Conservation of flow - answer-The flow into a vertex V must me equal to the flow 
out of the vertex V 
What problems are in the class NP-Hard? - answer-Any problem to which any 
problem in NP c...
Aperçu 1 sur 1 pages
Ajouter au panierIn a DAG, what makes a pair of vertices strongly connected? - answer-There is a 
path `V→W` and `W→V` 
Conservation of flow - answer-The flow into a vertex V must me equal to the flow 
out of the vertex V 
What problems are in the class NP-Hard? - answer-Any problem to which any 
problem in NP c...
Traversing, reversing, copying, or otherwise working on the full graph running 
time - ANSWER-O(n+m) 
Checking, reading, or removing one vertex running time - ANSWER-O(1) 
Iterating, checking, reading, removing, or otherwise working on all vertices 
running time - ANSWER-O(n) 
Checking, reading, or ...
Aperçu 1 sur 3 pages
Ajouter au panierTraversing, reversing, copying, or otherwise working on the full graph running 
time - ANSWER-O(n+m) 
Checking, reading, or removing one vertex running time - ANSWER-O(1) 
Iterating, checking, reading, removing, or otherwise working on all vertices 
running time - ANSWER-O(n) 
Checking, reading, or ...
Equivalence - ANSWER-"x ≡ y (mod N) means that x/N and y/N have the same 
remainder 
a ≡ b (mod N) and c ≡ d (mod N) then: 
a + c ≡ a + d ≡ b + c ≡ b + d (mod N) 
a - c ≡ a - d ≡ b - c ≡ b - d (mod N) 
a ** c ≡ a ** d ≡ b ** c ≡ b ** d (mod N) 
ka ≡ kb (mod N) for any inte...
Aperçu 2 sur 14 pages
Ajouter au panierEquivalence - ANSWER-"x ≡ y (mod N) means that x/N and y/N have the same 
remainder 
a ≡ b (mod N) and c ≡ d (mod N) then: 
a + c ≡ a + d ≡ b + c ≡ b + d (mod N) 
a - c ≡ a - d ≡ b - c ≡ b - d (mod N) 
a ** c ≡ a ** d ≡ b ** c ≡ b ** d (mod N) 
ka ≡ kb (mod N) for any inte...
What is the running time for Longest Increasing Subsequence (LIS) - 
ANSWER-O(n^2) 
What is the recurrence for Longest Increasing Subsequence (LIS)? - 
ANSWER-L(i) = 1 + max{ L(j) | xj < xi} 
This reads as the answer to index I is 1 + the maximum over all j's between 1 
and i where xj is less th...
Aperçu 1 sur 4 pages
Ajouter au panierWhat is the running time for Longest Increasing Subsequence (LIS) - 
ANSWER-O(n^2) 
What is the recurrence for Longest Increasing Subsequence (LIS)? - 
ANSWER-L(i) = 1 + max{ L(j) | xj < xi} 
This reads as the answer to index I is 1 + the maximum over all j's between 1 
and i where xj is less th...
How do you tell if a graph has negative edges? - ANSWER-when fitting graph on 
a table, if the number of moves decreases the w() from edge to edge, then there 
is a negative edge; 
check from 1 to n 
Why are all pairs Dist(y,z) n^2? - ANSWER-Because it builds a two dim table! 
What is the run time o...
Aperçu 3 sur 24 pages
Ajouter au panierHow do you tell if a graph has negative edges? - ANSWER-when fitting graph on 
a table, if the number of moves decreases the w() from edge to edge, then there 
is a negative edge; 
check from 1 to n 
Why are all pairs Dist(y,z) n^2? - ANSWER-Because it builds a two dim table! 
What is the run time o...
Search Problem - ANSWER-A search problem is specified by an algorithm C that 
takes two inputs, an instance I and a proposed solution S, and runs in time 
polynomial in |I|. We say S is a solution to I if and only if C(I, S) = true 
Steps for an NP Proof - ANSWER-1. Demonstrate that problem B is in ...
Aperçu 3 sur 21 pages
Ajouter au panierSearch Problem - ANSWER-A search problem is specified by an algorithm C that 
takes two inputs, an instance I and a proposed solution S, and runs in time 
polynomial in |I|. We say S is a solution to I if and only if C(I, S) = true 
Steps for an NP Proof - ANSWER-1. Demonstrate that problem B is in ...
Dynamic Programming Purpose - ANSWER-Used for optimization problems 
A set of choices must be made to get an optimal solution 
Find a solution with the optimal value (minimum or maximum) 
Dynamic Programming Applicability - ANSWER-Subproblems are not independent 
A divide-and-conquer approach would ...
Aperçu 2 sur 7 pages
Ajouter au panierDynamic Programming Purpose - ANSWER-Used for optimization problems 
A set of choices must be made to get an optimal solution 
Find a solution with the optimal value (minimum or maximum) 
Dynamic Programming Applicability - ANSWER-Subproblems are not independent 
A divide-and-conquer approach would ...
Computer Science 201: Data Structures & 
Algorithms Ch. 15
Aperçu 1 sur 2 pages
Ajouter au panierComputer Science 201: Data Structures & 
Algorithms Ch. 15
Dijkstra's algorithm 
O((n+m)log(n)). Used to find the shortest distance from one node to every other 
node in a graph. 
Inputs: 
- DAG G=(V,E) with edge weights 
- Source vertex s 
Output: 
- Array dist[...] that tells us the length of the shortest path from s to each other vertex. 
e.g. dist[v] g...
Aperçu 1 sur 3 pages
Ajouter au panierDijkstra's algorithm 
O((n+m)log(n)). Used to find the shortest distance from one node to every other 
node in a graph. 
Inputs: 
- DAG G=(V,E) with edge weights 
- Source vertex s 
Output: 
- Array dist[...] that tells us the length of the shortest path from s to each other vertex. 
e.g. dist[v] g...
Steps to solve a Dynamic Programming Problem - ANSWER-1. Define the Input 
and Output. 
2. Define entries in table, i.e. T(i) or T(i, j) is... 
3. Define a Recurrence relationship - Based on a subproblem to the main 
problem. (hint: use a prefix of the original input 1 < i < n). 
4. Define the...
Aperçu 1 sur 3 pages
Ajouter au panierSteps to solve a Dynamic Programming Problem - ANSWER-1. Define the Input 
and Output. 
2. Define entries in table, i.e. T(i) or T(i, j) is... 
3. Define a Recurrence relationship - Based on a subproblem to the main 
problem. (hint: use a prefix of the original input 1 < i < n). 
4. Define the...
Given the following list, 
my_list = [ 
[0, 1, 2], 
[3, 4, 5], 
[6, 7, 8], 
[9, 10, 11] 
] 
what will be printed when the following line of code is called? 
print(my_list[3][1:]) - ANSWER-[10, 11] 
Given the following list, 
my_list = [ 
[0, 1, 2], 
[3, 4, 5], 
[6, 7, 8], 
[9, 10, 11] 
] 
Which line...
Aperçu 2 sur 5 pages
Ajouter au panierGiven the following list, 
my_list = [ 
[0, 1, 2], 
[3, 4, 5], 
[6, 7, 8], 
[9, 10, 11] 
] 
what will be printed when the following line of code is called? 
print(my_list[3][1:]) - ANSWER-[10, 11] 
Given the following list, 
my_list = [ 
[0, 1, 2], 
[3, 4, 5], 
[6, 7, 8], 
[9, 10, 11] 
] 
Which line...
Les clients de Stuvia ont évalués plus de 700 000 résumés. C'est comme ça que vous savez que vous achetez les meilleurs documents.
Vous pouvez payer rapidement avec iDeal, carte de crédit ou Stuvia-crédit pour les résumés. Il n'y a pas d'adhésion nécessaire.
Vos camarades écrivent eux-mêmes les notes d’étude, c’est pourquoi les documents sont toujours fiables et à jour. Cela garantit que vous arrivez rapidement au coeur du matériel.
Vous obtenez un PDF, disponible immédiatement après votre achat. Le document acheté est accessible à tout moment, n'importe où et indéfiniment via votre profil.
Notre garantie de satisfaction garantit que vous trouverez toujours un document d'étude qui vous convient. Vous remplissez un formulaire et notre équipe du service client s'occupe du reste.
Stuvia est une place de marché. Alors, vous n'achetez donc pas ce document chez nous, mais auprès du vendeur AnswersCOM. Stuvia facilite les paiements au vendeur.
Non, vous n'achetez ce résumé que pour €20,53. Vous n'êtes lié à rien après votre achat.
4.6 étoiles sur Google & Trustpilot (+1000 avis)
79789 résumés ont été vendus ces 30 derniers jours
Fondée en 2010, la référence pour acheter des résumés depuis déjà 14 ans