Final Exam Solutions

Similar documents
Examples and applications on SSSP and MST

Strongly Connected Components

priority queue ADT heaps 1

Chapter 6 Folding. Folding

Week 3: Connected Subgraphs

COMP108 Algorithmic Foundations

1 Minimum Cut Problem

General Notes About 2007 AP Physics Scoring Guidelines

Searching Linked Lists. Perfect Skip List. Building a Skip List. Skip List Analysis (1) Assume the list is sorted, but is stored in a linked list.

On the Hamiltonian of a Multi-Electron Atom

Basic Polyhedral theory

Derangements and Applications

EEO 401 Digital Signal Processing Prof. Mark Fowler

Minimum Spanning Trees

Aim To manage files and directories using Linux commands. 1. file Examines the type of the given file or directory

As the matrix of operator B is Hermitian so its eigenvalues must be real. It only remains to diagonalize the minor M 11 of matrix B.

From Elimination to Belief Propagation

Section 6.1. Question: 2. Let H be a subgroup of a group G. Then H operates on G by left multiplication. Describe the orbits for this operation.

ECE602 Exam 1 April 5, You must show ALL of your work for full credit.

11/13/17. directed graphs. CS 220: Discrete Structures and their Applications. relations and directed graphs; transitive closure zybooks

Homework #3. 1 x. dx. It therefore follows that a sum of the

Search sequence databases 3 10/25/2016

International Journal of Scientific & Engineering Research, Volume 6, Issue 7, July ISSN

First derivative analysis

Slide 1. Slide 2. Slide 3 DIGITAL SIGNAL PROCESSING CLASSIFICATION OF SIGNALS

Gradebook & Midterm & Office Hours

TuLiP: A Software Toolbox for Receding Horizon Temporal Logic Planning & Computer Lab 2

Roadmap. XML Indexing. DataGuide example. DataGuides. Strong DataGuides. Multiple DataGuides for same data. CPS Topics in Database Systems

Computing and Communications -- Network Coding

Linked-List Implementation. Linked-lists for two sets. Multiple Operations. UNION Implementation. An Application of Disjoint-Set 1/9/2014

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

2008 AP Calculus BC Multiple Choice Exam

Abstract Interpretation: concrete and abstract semantics

Random Access Techniques: ALOHA (cont.)

UNTYPED LAMBDA CALCULUS (II)

A Propagating Wave Packet Group Velocity Dispersion

Function Spaces. a x 3. (Letting x = 1 =)) a(0) + b + c (1) = 0. Row reducing the matrix. b 1. e 4 3. e 9. >: (x = 1 =)) a(0) + b + c (1) = 0

4037 ADDITIONAL MATHEMATICS

Construction of asymmetric orthogonal arrays of strength three via a replacement method

Vishnu V. Narayan. January

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

The Equitable Dominating Graph

Steinberg s Conjecture is false

Fourier Transforms and the Wave Equation. Key Mathematics: More Fourier transform theory, especially as applied to solving the wave equation.

Kernels. ffl A kernel K is a function of two objects, for example, two sentence/tree pairs (x1; y1) and (x2; y2)

On spanning trees and cycles of multicolored point sets with few intersections

EXST Regression Techniques Page 1

Exam 1. It is important that you clearly show your work and mark the final answer clearly, closed book, closed notes, no calculator.

The Matrix Exponential

DIFFERENTIAL EQUATION

Eigenvalue Distributions of Quark Matrix at Finite Isospin Chemical Potential

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

6.1 Integration by Parts and Present Value. Copyright Cengage Learning. All rights reserved.

Approximate Maximum Flow in Undirected Networks by Christiano, Kelner, Madry, Spielmann, Teng (STOC 2011)

ECE 407 Computer Aided Design for Electronic Systems. Instructor: Maria K. Michael. Overview. CAD tools for multi-level logic synthesis:

Finding low cost TSP and 2-matching solutions using certain half integer subtour vertices

LR(0) Analysis. LR(0) Analysis

INC 693, 481 Dynamics System and Modelling: Linear Graph Modeling II Dr.-Ing. Sudchai Boonto Assistant Professor

4 x 4, and. where x is Town Square

The Matrix Exponential

10. EXTENDING TRACTABILITY

Higher order derivatives

CS 361 Meeting 12 10/3/18

Association (Part II)

Electrical Flows, Laplacian Systems, and Faster Approximation of Maximum Flow in Undirected Graphs

a 1and x is any real number.

The Transmission Line Wave Equation

Combinatorial Networks Week 1, March 11-12

10. The Discrete-Time Fourier Transform (DTFT)

GEOMETRICAL PHENOMENA IN THE PHYSICS OF SUBATOMIC PARTICLES. Eduard N. Klenov* Rostov-on-Don, Russia

Math 34A. Final Review

Minimum Spanning Trees

Sec 2.3 Modeling with First Order Equations

Hydrogen Atom and One Electron Ions

Analysis of Algorithms - Elementary graphs algorithms -

u r du = ur+1 r + 1 du = ln u + C u sin u du = cos u + C cos u du = sin u + C sec u tan u du = sec u + C e u du = e u + C

That is, we start with a general matrix: And end with a simpler matrix:

Analysis of Algorithms - Elementary graphs algorithms -

CS 491 G Combinatorial Optimization

Where k is either given or determined from the data and c is an arbitrary constant.

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

MCE503: Modeling and Simulation of Mechatronic Systems Discussion on Bond Graph Sign Conventions for Electrical Systems

SCHUR S THEOREM REU SUMMER 2005

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages:

Junction Tree Algorithm 1. David Barber

5. B To determine all the holes and asymptotes of the equation: y = bdc dced f gbd

Addition of angular momentum

Addition of angular momentum

Topic review Topic 9: Undirected graphs and networks

Superposition. Thinning

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

1 Solving Flow Problems using Multiplicative Weights

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

Approximation and Inapproximation for The Influence Maximization Problem in Social Networks under Deterministic Linear Threshold Model

Elements of Statistical Thermodynamics

cycle that does not cross any edges (including its own), then it has at least

There is an arbitrary overall complex phase that could be added to A, but since this makes no difference we set it to zero and choose A real.

Recounting the Rationals

Lie Groups HW7. Wang Shuai. November 2015

Transcription:

CS 2 Advancd Data Structurs and Algorithms Final Exam Solutions Jonathan Turnr /8/20. (0 points) Suppos that r is a root of som tr in a Fionacci hap. Assum that just for a dltmin opration, r has no childrn and that aftr th dltmin r has 0 childrn. Lt C th st of childrn of r aftr th dlt and lt ranks(c) th st of rank valus for th nods in C (sinc this is a st, if svral nods in C hav th sam rank, thir rank valu appars just onc in ranks(c)). What is th largst valu in ranks(c) right aftr th dltmin? That is what is max ranks(c)? 9 What is th valu of ranks(c) right aftr th dltmin? 0 Assum that som tim latr r is still a tr root and has th sam st of childrn. What is th smallst possil valu for max ranks(c) at this point? 8 What is th smallst possil valu for ranks(c) at this point? Suppos som tim latr, r is still a tr root ut no longr has th sam st of childrn? Lt C its currnt st of childrn. What is th smallst possil valu for C? 0 - -

2. (0 points) Th diagram low shows an intrmdiat stat in th xcution of th roundroin algorithm. Th partition data structur P is just shown as a collction of susts. Th lftist haps ar shown as sts of dgs. Th tr dgs ar not shown xplicitly. a d k P: {a,f} {,c} {,h,j} {d,g,i,k,m} 2 h(a)={af,fc,a,ad} f 2 g m 2 h(c)={cf,c,ch,a,d,} c h 2 j i h()={h,j,,g,j,ch,jh,ij} h(d)={ad,d,dg,dk,g,gi,gk,ij,im,km} Which dgs ar in th partial MST that has n found so far? af, c, h, j, dg, gi, gk, im In th hap h(d), which dgs would considrd dltd y th round-roin algorithm? dg, dk, gi, gk, im, km Suppos that h() is th first itm on th list usd y th round-roin algorithm. What is th nxt dg addd to th tr? ch Show th stat of th partition data structur aftr th nxt dg is addd (you may just list th sts in th partition data structur). {a,f}, {,c,,h,j}, {d,g,i,k,m} - 2 -

. (0 points) Considr th partial solution to th maximum wightd matching prolm shown low. a g d 7 h f 7 k 8 c i j List all th augmnting paths in this graph and th wight of ach path. cag cihg 0 chij jihg 2 jfkdg 2 Which of ths paths would slctd nxt y Edmonds algorithm? chij Suppos that during th xcution of Edmond s algorithm on som othr graph, dgs {a,}, {,c} and {a,c} form an odd lossom with as a. In addition, th tr containing this lossom also includs dgs {x,a} and {y,c}. Which of ths fiv dgs ar in th matching? c, ax Which of ths dgs must quality dgs? all fiv Which of ths vrtics is th parnt of th lossom? y - -

. (0 points) This prolm is concrnd with Dinic s algorithm on unit graphs. Lt G a unit graph with,000 vrtics and 0,000 dgs. Lt nw phass start at tims T and T 2 with T <T 2. Suppos that at tim T, lvl(t)= and at T 2, lvl(t)=0 (whr t is th sink). If vrtx u has incoming and 0 outgoing dgs, what is th largst numr of tims that nxtdg(u) can incrmntd twn T and T 2? *=7 Suppos that at tim T 2 th valu of th flow is 2. What is th largst possil valu for th maximum flow? If R is rsidual graph for currnt flow f, f* f is a flow on R that can dcomposd into paths of lngth 0 or mor. So, ach path contains at last 9 intrmdiat vrtics, with ach vrtx apparing on no mor than on path. So (998/9) f* f and sinc f =2, f* is at most 0+2=. Approximatly, what is th maximum possil numr of phass aftr tim T 2? Th numr of phass is at most 2 (n 2) /2 =. Sinc 9 phass hav alrady occurrd, thr can no mor than mor. - -

. (0 points) Th diagram low shows an implmntation of a dynamic tr usd y Dinic s algorithm (what Tarjan calls th virtual tr ). Draw th corrsponding actual tr that is implmntd y th givn virtual tr. Show how th tr is dividd into paths (that is, th show th dashd dgs) and for ach vrtx show its actual costs. a 2, Δmin, Δcost t 00 0, t 0,98 d h 0 p,0 2,0 d,0 g 9,0 m,2 a g 9 z 0, s w 2,0 0,0 k c 2,0 h n 2,0 x, i,0,0 f 0,0,0 p 7 c n i m w f z 7 x s k What is th augmnting path in th flow graph? szwmnadt What is th rsidual capacity of th path? Which dgs ar rmovd from th dynamic trs data structur aftr flow is addd to th path? wm,, dt - -

. ( points). In la, w usd an xtnsion on th asic d-hap that supports an fficint addtokys opration. Thr is anothr way to implmnt a hap with an fficint addtokys opration using a slf-adjusting inary sarch tr with vrtx costs that ar rprsntd using th diffrntial rprsntation usd in th dynamic trs data structur. Assuming that th hap wr rprsntd in this way, dscri an fficint mthod to implmnt th mthod ky(x), which rturns th ky valu for nod x. Kp in mind that to mak this fficint, th tr must rstructurd in th usual way for slf-adjusting trs. You can assum that th undrlying rotation mthods updat th Δmin and Δky valus as ndd. splay(x); rturn Δmin(x) Dscri an fficint algorithm that implmnts th findmin opration on th hap. If Δcost(root)=0, rturn root. Othrwis, slct a child of root with Δmin=0. Continu down th tr through nods with Δmin=0. Stop at th first nod x with Δcost=0. Splay(x) and rturn x. Dscri an fficint algorithm for implmnting th mthod insrt(u,k,root) whr u is a nw nod, k is its ky valu and root is th currnt root of th tr. Hint: not that u can insrtd at any location in th tr. Mak u th nw tr root and lt right(u)=root, p(root)=u. Lt Δmin(u)=min(k, Δmin(root)), Δcost(u)=k Δmin(u) and Δmin(root)=Δmin(root) Δmin(u). - -

7. (0 points) Lt T a alancd inary sarch tr (aka rd-lack tr) containing a laf u with dpth(u)=0 and a laf v with dpth(v)=? What is th smallst possil rank for th root of T. What is th largst possil rank? Th smallst possil rank is 7, th largst is. Approximatly, what is th smallst possil numr of nods in T? Th largst? A nod with rank 7 must hav at last 2 7 =27 nods in its tr. A nod with rank 22 may hav at most 2 22 dscndants, or aout million. Show th tr that rsults from prforming th opration join(a,p,x) on th st of sarch trs shown low. Th numrs shown ar th ranks. Ky valus hav n omittd. Don t forgt to ralanc and show th final rank valus. a p x f g c f a c g h d h i d i p x - 7 -

8. (0 points) Th figur at right shows what Tarjan calls a virtual tr (that is, th undrlying implmntation of th dynamic trs data structur). Each triangl rprsnts on solid tr,, q and y ar laf nods in thir trs and th numrs in th triangls rprsnt th numr of nods in thos trs. (so, th tr containing p and q has 00 nods). Lal ach of th vrtics a,, p, q, x and y with its individual wight, total wight and rank. Suppos w do a splay at nod y in th sarch tr with root x. How many nw crdits do w nd to nsur that w can pay for th splay and maintain th crdit invariant? *( 0)+=9 0 a 8,800,9 200 0 2,2,9 p,20,9 00 q 2,2, 20 x 00 y,00,,,0 Suppos w do splays at th thr nods y, q and? How many nw crdits do w nd to nsur that w can pay for all th splay stps in ths splays and maintain th crdit invariant? *(9 0)+=0-8 -

9. (0 points). Suppos w apply th FIFO variant of th prflow-push algorithm to a graph with 00 vrtics and 00 dgs. Approximatly, what is th maximum numr of stps that rlal a vrtx? <2n 2 =20,000 Suppos u is a vrtx with 0 incidnt dgs. Approximatly, what is th maximum numr of tims that nxtdg(u) is advancd during th xcution of th algorithm? 0*(numr of tims u is rlald)<20n=2000 Suppos that at th start of som pass, th valu of th potntial function usd in th analysis is 7. Suppos that during this pass, vry stp concluds y adding flow to an dg without saturating it. What is th largst possil valu of th potntial function at th nd of th pass? Suppos that during som othr pass, th potntial function incrass from to 7. What is th smallst possil numr of ralancing stps that can occur during this pass? - 9 -