Today s Outline. CS 362, Lecture 19. DFS and BFS. Generic Traverse. BFS and DFS Wrapup Shortest Paths. Jared Saia University of New Mexico

Size: px
Start display at page:

Download "Today s Outline. CS 362, Lecture 19. DFS and BFS. Generic Traverse. BFS and DFS Wrapup Shortest Paths. Jared Saia University of New Mexico"

Transcription

1 Today Outline CS 362, Lecture 9 Jared Saia Univerity of New Mexico BFS and DFS Wrapup Shortet Path Generic Travere DFS and BFS Travere(){ put (nil,) in bag; while (the bag i not empty){ take ome edge (p,v) from the bag if (v i unmarked) mark v; parent(v) = p; for each edge (v,w) incident to v{ put (v,w) into the bag; If we implement the bag by uing a tack, we have Depth Firt Search If we implement the bag by uing a queue, we have Breadth Firt Search 2 3

2 Analyi Final DFS v Note BFS Note Notethat thatif ifwe weue ueadjacency lit litfor forthe thegraph, the theoverhead for forthe the for for loop loopi ionly onlya acontant per peredge (no (nomatter how we weimplement the thebag) If Ifwe weimplement the thebag baguing either tack or orqueue, each operation on onthe thebag bagtake contant time Hence the theoverall runtime i io( V + E ) = O( E ) Now Noteaume that DFS thetree edgetend are to weighted be long and kinny while BFS If tree we are implement hort and the fat bag uing a priority queue, alway extracting In addition, the the minimum BFS tree weight contain edgehortet from the path bag, from thenthe we have tartavertex verion to ofevery Prim other algorithm vertex in it connected component. extraction (here we define from the length bag of now a path take to O( E ) be the number time o Each the of edge total running the path) time i O( V + E log E ) 56 DFS Finalv Note BFS Note Nowthat aume DFSthe tree edge tend aretoweighted be long and kinny while BFS tree If weare implement hort andthe fat bag uing a priority queue, alway Inextracting addition, the minimum BFS treeweight contain edge hortet from the path bag, from thenthe we tart havevertex a verion toof every Prim other algorithm vertex in it connected component. Each(here extraction we define fromthe the length bag ofnow a path take to be O( E ) the number time o ofthe edge total inrunning the path) time i O( V + E log E ) b d b d a f a f c e c e depth-firt panning tree and breadth-firt panning tree A depth-firt panning tree and a breadth-firt panning tree of one component of the example graph, with tart vertex a. of one component of the example graph, with tart vertex a. 56

3 Searching Diconnected Graph DFS and BFS If the graph i diconnected, then Travere only viit node in the connected component of the tart vertex. If we want to viit all vertice, we can ue the following wrapper around Travere TravereAll(){ for all vertice v{ if (v i unmarked){ Travere(v); Note that we can do DFS and BFS equally well on undirected and directed graph If the graph i undirected, there are two type of edge in G: edge that are in the DFS or BFS tree and edge that are not in thi tree If the graph i directed, there are everal type of edge 9 DFS in Directed Graph Acyclic graph Tree edge are edge that are in the tree itelf Back edge are thoe edge (u, v) connecting a vertex u to an ancetor v in the DFS tree Forward edge are nontree edge (u, v) that connect a vertex u to a decendant in a DFS tree Cro edge are all other edge. They go between two vertice where neither vertex i a decendant of the other Ueful Fact: A directed graph G i acyclic if and only if a DFS of G yeild no back edge Challenge: Try to prove thi fact. 0

4 Take Away Shortet Path Problem BFS and DFS are two ueful algorithm for exploring graph Each of thee algorithm i an intantiation of the Travere algorithm. BFS ue a queue to hold the edge and DFS ue a tack Each of thee algorithm contruct a panning tree of all the node which are reachable from the tart node Another intereting problem for graph i that of finding hortet path Aume we are given a weighted directed graph G = (V, E) with two pecial vertice, a ource and a target t We want to find the hortet directed path from to t In other word, we want to find the path p tarting at and ending at t minimizing the function w(p) = e p w(e) 3 SSSP Imagine we want to find the fatet way to drive from Albuquerque,NM to Seattle,WA We might ue a graph whoe vertice are citie, edge are road, weight are driving time, i Albuquerque and t i Seattle The graph i directed ince driving time along the ame road might be different in different direction (e.g. becaue of contruction, peed trap, etc) Every algorithm known for olving thi problem actually olve the following more general ingle ource hortet path or SSSP problem: Find the hortet path from the ource vertex to every other vertex in the graph Thi problem i uually olved by finding a hortet path tree rooted at that contain all the deired hortet path 5

5 Shortet Path Tree It not hard to ee that if the hortet path are unique, then they form a tree Shortet Path Tree To prove thi, we need only oberve that the ub-path of hortet path are themelve hortet path If there are multiple hotet path to the ame vertex, we can alway chooe jut one of them, o that the union of the path i a tree If there are hortet path to two vertice u and v which hortet path are themelve hortet path diverge, then meet, then diverge again, we can modify one of the path o that the two path diverge once only. It not hard to ee that if the hortet path are unique, then they form a tree To prove thi, we need only oberve that the ub-path of If there are multiple hotet path to the ame vertex, we can alway chooe jut one of them, o that the union of the path i a tree If there are hortet path to two vertice u and v which diverge, then meet, then diverge again, we can modify one of the path o that the two path diverge once only. 6 MST v SPT a b x If If a a b b c c d d v vand a x y d u are areboth hortet path, Note that the minimum panning tree and hortet path tree then then a a b b c c d u i alo a hortet path. can be different For one thing there may be only one MST but there can be multiple hortet path tree (one for every ource vertex) c y d u v MST v SPT 6 b c u a d Note that the minimum panning tree and hortet path tree can be different x y v For one thing there may be only one MST but there can be hortet path, multiple hortet path tree (one for every ource vertex) If a b c d v and a x y d u are both then a b c d u i alo a hortet path A minimum panning tree (left) and a hortet path tree rooted at the topmot vertex (right). A minimum panning tree (left) and a hortet path tree rooted at the topmot vertex (right). 9 9

6 Negative Weight e ll actually allow negative weight on edge he preence of a negative cycle might mean that there i We ll actually allow negative weight on edge hortet path The preence of a negative cycle might mean that there i hortet no path hortetfrom path to t exit if and only if there i at at one Apath hortetfrom path from to tot tbut exitno if and path only from if there i at to t that leat one path from to t no path from to t that uche atouche negative a negative cycle cycle the following In the following example, there i no hortet path path from to from t to t t SSSP Algorithm Each vertex v in the graph will tore t a tentative hortet path from to v We ll now go over ome algorithm for SSSP on directed graph. Thee algorithm will work for undirected graph with light modification In particular, we mut pecifically prohibit alternating back and forth acro the ame undirected negative-weight edge Like for graph traveral, all the SSSP algorithm will be pecial cae of a ingle generic algorithm dit(v) i the length of the tentati and v pred(v) i the predeceor of v in th The predeceor pointer automa hortet path tree 20 2 SSSP Algorithm 20 Defn SSSP Algorithm Each vertex v in the graph will tore two value which decribe a tentative hortet path from to v dit(v) i the length of the tentative hortet path between and v pred(v) i the predeceor of v in thi tentative hortet path e ll now The gopredeceor over ome pointer algorithm automaticallyfor define SSSP a tentative on directed aph. hortet path tree hee algorithm will work for undirected graph with light odification particular, we mut pecifically prohibit alternating back 22 d forth acro the ame undirected negative-weight edge Initially we et: Defn dit() = 0, pred() = NULL For every vertex v, dit(v) = and pred(v) = NULL Initially we et: dit() = 0, pred() = NULL 23 For every vertex v, dit(v) =

7 Relaxation Relax We call an edge (u, v) tene if dit(u) + w(u, v) < dit(v) If (u, v) i tene, then the tentative hortet path from to v i incorrect ince the path to u and then (u, v) i horter Our generic algorithm repeatedly find a tene edge in the graph and relaxe it If there are no tene edge, our algorithm i finihed and we have our deired hortet path tree Relax(u,v){ dit(v) = dit(u) + w(u,v); pred(v) = u; 2 25 Correctne Claim The correctne of the relaxation algorithm follow directly from three imple claim The run time of the algorithm will depend on the way that we make choice about which edge to relax If dit(v), then dit(v) i the total weight of the predeceor chain ending at v: pred(pred(v)) pred(v) v. Thi i eay to prove by induction on the number of edge in the path from to v. (left a an exercie) 26 2

8 Claim 2 Claim 3 If the algorithm halt, then dit(v) w( v) for any path v. Thi i eay to prove by induction on the number of edge in the path v. (which you will do in the hw) The algorithm halt if and only if there i no negative cycle reachable from. The only if direction i eay if there i a reachable negative cycle, then after the firt edge in the cycle i relaxed, the cycle alway ha at leat one tene edge. The if direction follow from the fact that every relaxation tep reduce either the number of vertice with dit(v) = by or reduce the um of the finite hortet path length by ome poitive amount Generic SSSP InitSSSP We haven t yet aid how to detect which edge can be relaxed or what order to relax them in The following Generic SSSP algorithm anwer thee quetion We will maintain a bag of vertice initially containing jut the ource vertex Whenever we take a vertex u out of the bag, we can all of it outgoing edge, looking for omething to relax Whenever we uccefully relax an edge (u, v), we put v in the bag InitSSSP(){ dit() = 0; pred() = NULL; for all vertice v = { dit(v) = infinity; pred(v) = NULL; 30 3

9 GenericSSSP Generic SSSP GenericSSSP(){ InitSSSP(); put in the bag; while the bag i not empty{ take u from the bag; for all edge (u,v){ if (u,v) i tene{ Relax(u,v); put v in the bag; Jut a with graph traveral, uing different data tructure for the bag give u different algorithm Some obviou choice are: a tack, a queue and a heap Unfortunately if we ue a tack, we need to perform Θ(2 E ) relaxation tep in the wort cae (an exercie for the diligent tudent) The other poibilitie are more efficient Diktra Algorithm Dijktra Algorithm If we implement the bag a a heap, where the key of a vertex v i dit(v), we obtain Dijktra algorithm Dijktra algorithm doe particularly well if the graph ha no negative-weight edge In thi cae, it not hard to how (by induction, of coure) that the vertice are canned in increaing order of their hortet-path ditance from It follow that each vertex i canned at mot once, and thu that each edge i relaxed at mot once Since the key of each vertex in the heap i it tentative ditance from, the algorithm perform a DecreaeKey operation every time an edge i relaxed Thu the algorithm perform at mot E DecreaeKey Similarly, there are at mot V Inert and ExtractMin operation Thu if we tore the vertice in a Fibonacci heap, the total running time of Dijktra algorithm i O( E + V log V ) 3 35

10 Negative Edge Thi analyi aume that no edge ha negative weight The algorithm given here i till correct if there are negative weight edge but the wort-cae run time could be exponential The algorithm in our text book give incorrect reult for graph with negative edge (which they make clear) Four phae of Dijktra algorithm run on graph with no negative edge. Four phae of Dijktra algorithm run on a graph with no negative edge. At each phae, the haded vertice are in the heap, and the bold vertex ha At each phae, the haded vertice are in the heap, and the bold vertex ha jut been canned. The bold edge decribe jut been the canned. evolving hortet path tree. The bold edge decribe the evolving hortet path tree

Generic Traverse. CS 362, Lecture 19. DFS and BFS. Today s Outline

Generic Traverse. CS 362, Lecture 19. DFS and BFS. Today s Outline Generic Travere CS 62, Lecture 9 Jared Saia Univerity of New Mexico Travere(){ put (nil,) in bag; while (the bag i not empty){ take ome edge (p,v) from the bag if (v i unmarked) mark v; parent(v) = p;

More information

Today s Outline. CS 561, Lecture 23. Negative Weights. Shortest Paths Problem. The presence of a negative cycle might mean that there is

Today s Outline. CS 561, Lecture 23. Negative Weights. Shortest Paths Problem. The presence of a negative cycle might mean that there is Today Outline CS 56, Lecture Jared Saia Univerity of New Mexico The path that can be trodden i not the enduring and unchanging Path. The name that can be named i not the enduring and unchanging Name. -

More information

Shortest Paths Problem. CS 362, Lecture 20. Today s Outline. Negative Weights

Shortest Paths Problem. CS 362, Lecture 20. Today s Outline. Negative Weights Shortet Path Problem CS 6, Lecture Jared Saia Univerity of New Mexico Another intereting problem for graph i that of finding hortet path Aume we are given a weighted directed graph G = (V, E) with two

More information

CS 561, Lecture 10. Jared Saia University of New Mexico

CS 561, Lecture 10. Jared Saia University of New Mexico CS 561, Lecture 10 Jared Saia University of New Mexico Today s Outline The path that can be trodden is not the enduring and unchanging Path. The name that can be named is not the enduring and unchanging

More information

CS 561, Lecture 10. Jared Saia University of New Mexico

CS 561, Lecture 10. Jared Saia University of New Mexico CS 561, Lecture 10 Jared Saia University of New Mexico Today s Outline The path that can be trodden is not the enduring and unchanging Path. The name that can be named is not the enduring and unchanging

More information

Lecture 14: Minimum Spanning Tree I

Lecture 14: Minimum Spanning Tree I COMPSCI 0: Deign and Analyi of Algorithm October 4, 07 Lecture 4: Minimum Spanning Tree I Lecturer: Rong Ge Scribe: Fred Zhang Overview Thi lecture we finih our dicuion of the hortet path problem and introduce

More information

Contents. shortest paths. Notation. Shortest path problem. Applications. Algorithms and Networks 2010/2011. In the entire course:

Contents. shortest paths. Notation. Shortest path problem. Applications. Algorithms and Networks 2010/2011. In the entire course: Content Shortet path Algorithm and Network 21/211 The hortet path problem: Statement Verion Application Algorithm (for ingle ource p problem) Reminder: relaxation, Dijktra, Variant of Dijktra, Bellman-Ford,

More information

Algorithmic Discrete Mathematics 4. Exercise Sheet

Algorithmic Discrete Mathematics 4. Exercise Sheet Algorithmic Dicrete Mathematic. Exercie Sheet Department of Mathematic SS 0 PD Dr. Ulf Lorenz 0. and. May 0 Dipl.-Math. David Meffert Verion of May, 0 Groupwork Exercie G (Shortet path I) (a) Calculate

More information

Robert Bryan and Marshall Dodge, Bert and I and Other Stories from Down East (1961) Michelle Shocked, Arkansas Traveler (1992)

Robert Bryan and Marshall Dodge, Bert and I and Other Stories from Down East (1961) Michelle Shocked, Arkansas Traveler (1992) Well, ya turn left by the fire tation in the village and take the old pot road by the reervoir and...no, that won t do. Bet to continue traight on by the tar road until you reach the choolhoue and then

More information

Lecture 17: Shortest Paths

Lecture 17: Shortest Paths Lecture 7: Shortet Path CSE 373: Data Structure and Algorithm CSE 373 9 WI - KASEY CHAMPION Adminitrivia How to Ace the Technical Interview Seion today! - 6-8pm - Sieg 34 No BS CS Career Talk Thurday -

More information

8.1 Shortest Path Trees

8.1 Shortest Path Trees I tudy my Bible a I gather apple. Firt I hake the whole tree, that the ripet might fall. Then I climb the tree and hake each limb, and then each branch and then each twig, and then I look under each leaf.

More information

Delaunay Triangulation: Incremental Construction

Delaunay Triangulation: Incremental Construction Chapter 6 Delaunay Triangulation: Incremental Contruction In the lat lecture, we have learned about the Lawon ip algorithm that compute a Delaunay triangulation of a given n-point et P R 2 with O(n 2 )

More information

Topics. Lecture 37: Global Optimization. Issues. A Simple Example: Copy Propagation X := 3 B > 0 Y := 0 X := 4 Y := Z + W A := 2 * 3X

Topics. Lecture 37: Global Optimization. Issues. A Simple Example: Copy Propagation X := 3 B > 0 Y := 0 X := 4 Y := Z + W A := 2 * 3X Lecture 37: Global Optimization [Adapted from note by R. Bodik and G. Necula] Topic Global optimization refer to program optimization that encompa multiple baic block in a function. (I have ued the term

More information

Graphs: Finding shortest paths

Graphs: Finding shortest paths /0/01 Graph: Finding hortet path Tecniche di Programmazione Summary Definition Floyd-Warhall algorithm Bellman-Ford-Moore algorithm Dijktra algorithm 1 /0/01 Definition Graph: Finding hortet path Definition:

More information

Lecture 18 Graph-Based Algorithms. CSE373: Design and Analysis of Algorithms

Lecture 18 Graph-Based Algorithms. CSE373: Design and Analysis of Algorithms Lecture 18 Graph-Baed Algorithm CSE: Deign and Anali of Algorithm Shortet Path Problem Modeling problem a graph problem: Road map i a weighted graph: vertice = citie edge = road egment between citie edge

More information

CS 151. Graph Algorithms. Wednesday, November 28, 12

CS 151. Graph Algorithms. Wednesday, November 28, 12 CS 151 Graph Algorithm 1 Unweighted Shortet Path Problem input: a graph G=(V,E) and a tart vertex goal: determine the length of the hortet path from to every vertex in V (and while you re at it, compute

More information

1 The secretary problem

1 The secretary problem Thi i new material: if you ee error, pleae email jtyu at tanford dot edu 1 The ecretary problem We will tart by analyzing the expected runtime of an algorithm, a you will be expected to do on your homework.

More information

CS 4349 Lecture October 23rd, 2017

CS 4349 Lecture October 23rd, 2017 CS 4349 Lecture October 23rd, 2017 Main topics for #lecture include #minimum_spanning_trees and #SSSP. Prelude Homework 7 due Wednesday, October 25th. Don t forget about the extra credit. Minimum Spanning

More information

Minimum congestion spanning trees in bipartite and random graphs

Minimum congestion spanning trees in bipartite and random graphs Minimum congetion panning tree in bipartite and random graph M.I. Otrovkii Department of Mathematic and Computer Science St. John Univerity 8000 Utopia Parkway Queen, NY 11439, USA e-mail: otrovm@tjohn.edu

More information

Shortest Path Problems

Shortest Path Problems Shortet Path Problem How can we find the hortet route between two point on a road map? Model the problem a a graph problem: Road map i a weighted graph: vertice = citie edge = road egment between citie

More information

Algorithms. Algorithms 4.4 S HORTEST P ATHS. APIs shortest-paths properties. Dijkstra's algorithm edge-weighted DAGs negative weights

Algorithms. Algorithms 4.4 S HORTEST P ATHS. APIs shortest-paths properties. Dijkstra's algorithm edge-weighted DAGs negative weights Algorithm Shortet path in an edge-weighted digraph R OBERT S EDGEWICK K EVIN W AYNE Given an edge-weighted digraph, find the hortet path from to t. edge-weighted digraph ->. ->. ->7.7 ->7.28 7->.28 ->.2

More information

Routing Definition 4.1

Routing Definition 4.1 4 Routing So far, we have only looked at network without dealing with the iue of how to end information in them from one node to another The problem of ending information in a network i known a routing

More information

Lecture Outline. Global flow analysis. Global Optimization. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization

Lecture Outline. Global flow analysis. Global Optimization. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization Lecture Outline Global flow analyi Global Optimization Global contant propagation Livene analyi Adapted from Lecture by Prof. Alex Aiken and George Necula (UCB) CS781(Praad) L27OP 1 CS781(Praad) L27OP

More information

CERIAS Tech Report EFFICIENT PARALLEL ALGORITHMS FOR PLANAR st-graphs. by Mikhail J. Atallah, Danny Z. Chen, and Ovidiu Daescu

CERIAS Tech Report EFFICIENT PARALLEL ALGORITHMS FOR PLANAR st-graphs. by Mikhail J. Atallah, Danny Z. Chen, and Ovidiu Daescu CERIAS Tech Report 2003-15 EFFICIENT PARALLEL ALGORITHMS FOR PLANAR t-graphs by Mikhail J. Atallah, Danny Z. Chen, and Ovidiu Daecu Center for Education and Reearch in Information Aurance and Security,

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each type of circuit will be implemented in two

More information

arxiv: v1 [cs.ds] 27 Feb 2018

arxiv: v1 [cs.ds] 27 Feb 2018 Incremental Strong Connectivity and 2-Connectivity in Directed Graph Louka Georgiadi 1, Giueppe F. Italiano 2, and Niko Parotidi 2 arxiv:1802.10189v1 [c.ds] 27 Feb 2018 1 Univerity of Ioannina, Greece.

More information

Karen L. Collins. Wesleyan University. Middletown, CT and. Mark Hovey MIT. Cambridge, MA Abstract

Karen L. Collins. Wesleyan University. Middletown, CT and. Mark Hovey MIT. Cambridge, MA Abstract Mot Graph are Edge-Cordial Karen L. Collin Dept. of Mathematic Weleyan Univerity Middletown, CT 6457 and Mark Hovey Dept. of Mathematic MIT Cambridge, MA 239 Abtract We extend the definition of edge-cordial

More information

xy-monotone path existence queries in a rectilinear environment

xy-monotone path existence queries in a rectilinear environment CCCG 2012, Charlottetown, P.E.I., Augut 8 10, 2012 xy-monotone path exitence querie in a rectilinear environment Gregory Bint Anil Mahehwari Michiel Smid Abtract Given a planar environment coniting of

More information

Stochastic Search and Graph Techniques for MCM Path Planning Christine D. Piatko, Christopher P. Diehl, Paul McNamee, Cheryl Resch and I-Jeng Wang

Stochastic Search and Graph Techniques for MCM Path Planning Christine D. Piatko, Christopher P. Diehl, Paul McNamee, Cheryl Resch and I-Jeng Wang Stochatic Search and Graph Technique for MCM Path Planning Chritine D. Piatko, Chritopher P. Diehl, Paul McNamee, Cheryl Rech and I-Jeng Wang The John Hopkin Univerity Applied Phyic Laboratory, Laurel,

More information

CS201: Data Structures and Algorithms. Assignment 2. Version 1d

CS201: Data Structures and Algorithms. Assignment 2. Version 1d CS201: Data Structure and Algorithm Aignment 2 Introduction Verion 1d You will compare the performance of green binary earch tree veru red-black tree by reading in a corpu of text, toring the word and

More information

A SIMPLE IMPERATIVE LANGUAGE THE STORE FUNCTION NON-TERMINATING COMMANDS

A SIMPLE IMPERATIVE LANGUAGE THE STORE FUNCTION NON-TERMINATING COMMANDS A SIMPLE IMPERATIVE LANGUAGE Eventually we will preent the emantic of a full-blown language, with declaration, type and looping. However, there are many complication, o we will build up lowly. Our firt

More information

Localized Minimum Spanning Tree Based Multicast Routing with Energy-Efficient Guaranteed Delivery in Ad Hoc and Sensor Networks

Localized Minimum Spanning Tree Based Multicast Routing with Energy-Efficient Guaranteed Delivery in Ad Hoc and Sensor Networks Localized Minimum Spanning Tree Baed Multicat Routing with Energy-Efficient Guaranteed Delivery in Ad Hoc and Senor Network Hanne Frey Univerity of Paderborn D-3398 Paderborn hanne.frey@uni-paderborn.de

More information

Shortest Paths with Single-Point Visibility Constraint

Shortest Paths with Single-Point Visibility Constraint Shortet Path with Single-Point Viibility Contraint Ramtin Khoravi Mohammad Ghodi Department of Computer Engineering Sharif Univerity of Technology Abtract Thi paper tudie the problem of finding a hortet

More information

Brief Announcement: Distributed 3/2-Approximation of the Diameter

Brief Announcement: Distributed 3/2-Approximation of the Diameter Brief Announcement: Ditributed /2-Approximation of the Diameter Preliminary verion of a brief announcement to appear at DISC 14 Stephan Holzer MIT holzer@mit.edu David Peleg Weizmann Intitute david.peleg@weizmann.ac.il

More information

Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz

Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz Operational emantic Page Operational emantic Cla note for a lecture given by Mooly agiv Tel Aviv Univerity 4/5/7 By Roy Ganor and Uri Juhaz Reference emantic with Application, H. Nielon and F. Nielon,

More information

Computer Arithmetic Homework Solutions. 1 An adder for graphics. 2 Partitioned adder. 3 HDL implementation of a partitioned adder

Computer Arithmetic Homework Solutions. 1 An adder for graphics. 2 Partitioned adder. 3 HDL implementation of a partitioned adder Computer Arithmetic Homework 3 2016 2017 Solution 1 An adder for graphic In a normal ripple carry addition of two poitive number, the carry i the ignal for a reult exceeding the maximum. We ue thi ignal

More information

Midterm 2 March 10, 2014 Name: NetID: # Total Score

Midterm 2 March 10, 2014 Name: NetID: # Total Score CS 3 : Algorithm and Model of Computation, Spring 0 Midterm March 0, 0 Name: NetID: # 3 Total Score Max 0 0 0 0 Grader Don t panic! Pleae print your name and your NetID in the boxe above. Thi i a cloed-book,

More information

A note on degenerate and spectrally degenerate graphs

A note on degenerate and spectrally degenerate graphs A note on degenerate and pectrally degenerate graph Noga Alon Abtract A graph G i called pectrally d-degenerate if the larget eigenvalue of each ubgraph of it with maximum degree D i at mot dd. We prove

More information

Touring a Sequence of Polygons

Touring a Sequence of Polygons Touring a Sequence of Polygon Mohe Dror (1) Alon Efrat (1) Anna Lubiw (2) Joe Mitchell (3) (1) Univerity of Arizona (2) Univerity of Waterloo (3) Stony Brook Univerity Problem: Given a equence of k polygon

More information

Shortest Paths. Dijkstra's algorithm implementation negative weights. Google maps. Shortest paths in a weighted digraph. Shortest path versions

Shortest Paths. Dijkstra's algorithm implementation negative weights. Google maps. Shortest paths in a weighted digraph. Shortest path versions Google map Shortet Path Dijktra' algorithm implementation negatie eight Reference: Algorithm in Jaa, Chapter http://.c.princeton.edu/alg/p Algorithm in Jaa, th Edition Robert Sedgeick and Kein Wayne Copyright

More information

Chapter S:II (continued)

Chapter S:II (continued) Chapter S:II (continued) II. Baic Search Algorithm Sytematic Search Graph Theory Baic State Space Search Depth-Firt Search Backtracking Breadth-Firt Search Uniform-Cot Search AND-OR Graph Baic Depth-Firt

More information

Advanced Encryption Standard and Modes of Operation

Advanced Encryption Standard and Modes of Operation Advanced Encryption Standard and Mode of Operation G. Bertoni L. Breveglieri Foundation of Cryptography - AES pp. 1 / 50 AES Advanced Encryption Standard (AES) i a ymmetric cryptographic algorithm AES

More information

AVL Tree. The height of the BST be as small as possible

AVL Tree. The height of the BST be as small as possible 1 AVL Tree re and Algorithm The height of the BST be a mall a poible The firt balanced BST. Alo called height-balanced tree. Introduced by Adel on-vel kii and Landi in 1962. BST with the following condition:

More information

Announcements. CSE332: Data Abstractions Lecture 19: Parallel Prefix and Sorting. The prefix-sum problem. Outline. Parallel prefix-sum

Announcements. CSE332: Data Abstractions Lecture 19: Parallel Prefix and Sorting. The prefix-sum problem. Outline. Parallel prefix-sum Announcement Homework 6 due Friday Feb 25 th at the BEGINNING o lecture CSE332: Data Abtraction Lecture 19: Parallel Preix and Sorting Project 3 the lat programming project! Verion 1 & 2 - Tue March 1,

More information

Shortest Paths in Directed Graphs

Shortest Paths in Directed Graphs Shortet Path in Direted Graph Jonathan Turner January, 0 Thi note i adapted from Data Struture and Network Algorithm y Tarjan. Let G = (V, E) e a direted graph and let length e a real-valued funtion on

More information

Touring a Sequence of Polygons

Touring a Sequence of Polygons Touring a Sequence of Polygon Mohe Dror (1) Alon Efrat (1) Anna Lubiw (2) Joe Mitchell (3) (1) Univerity of Arizona (2) Univerity of Waterloo (3) Stony Brook Univerity Problem: Given a equence of k polygon

More information

CORRECTNESS ISSUES AND LOOP INVARIANTS

CORRECTNESS ISSUES AND LOOP INVARIANTS The next everal lecture 2 Study algorithm for earching and orting array. Invetigate their complexity how much time and pace they take Formalize the notion of average-cae and wort-cae complexity CORRECTNESS

More information

Shortest Path Routing in Arbitrary Networks

Shortest Path Routing in Arbitrary Networks Journal of Algorithm, Vol 31(1), 1999 Shortet Path Routing in Arbitrary Network Friedhelm Meyer auf der Heide and Berthold Vöcking Department of Mathematic and Computer Science and Heinz Nixdorf Intitute,

More information

Course Updates. Reminders: 1) Assignment #13 due Monday. 2) Mirrors & Lenses. 3) Review for Final: Wednesday, May 5th

Course Updates. Reminders: 1) Assignment #13 due Monday. 2) Mirrors & Lenses. 3) Review for Final: Wednesday, May 5th Coure Update http://www.phy.hawaii.edu/~varner/phys272-spr0/phyic272.html Reminder: ) Aignment #3 due Monday 2) Mirror & Lene 3) Review for Final: Wedneday, May 5th h R- R θ θ -R h Spherical Mirror Infinite

More information

else end while End References

else end while End References 621-630. [RM89] [SK76] Roenfeld, A. and Melter, R. A., Digital geometry, The Mathematical Intelligencer, vol. 11, No. 3, 1989, pp. 69-72. Sklanky, J. and Kibler, D. F., A theory of nonuniformly digitized

More information

Lecture 8: More Pipelining

Lecture 8: More Pipelining Overview Lecture 8: More Pipelining David Black-Schaffer davidbb@tanford.edu EE8 Spring 00 Getting Started with Lab Jut get a ingle pixel calculating at one time Then look into filling your pipeline Multiplier

More information

Uninformed Search Complexity. Informed Search. Search Revisited. Day 2/3 of Search

Uninformed Search Complexity. Informed Search. Search Revisited. Day 2/3 of Search Informed Search ay 2/3 of Search hap. 4, Ruel & Norvig FS IFS US PFS MEM FS IS Uninformed Search omplexity N = Total number of tate = verage number of ucceor (branching factor) L = Length for tart to goal

More information

CS 561, Lecture 9. Jared Saia University of New Mexico

CS 561, Lecture 9. Jared Saia University of New Mexico CS 561, Lecture 9 Jared Saia University of New Mexico Today s Outline Minimum Spanning Trees Safe Edge Theorem Kruskal and Prim s algorithms Graph Representation 1 Graph Definition A graph is a pair of

More information

MAT 155: Describing, Exploring, and Comparing Data Page 1 of NotesCh2-3.doc

MAT 155: Describing, Exploring, and Comparing Data Page 1 of NotesCh2-3.doc MAT 155: Decribing, Exploring, and Comparing Data Page 1 of 8 001-oteCh-3.doc ote for Chapter Summarizing and Graphing Data Chapter 3 Decribing, Exploring, and Comparing Data Frequency Ditribution, Graphic

More information

Size Balanced Tree. Chen Qifeng (Farmer John) Zhongshan Memorial Middle School, Guangdong, China. December 29, 2006.

Size Balanced Tree. Chen Qifeng (Farmer John) Zhongshan Memorial Middle School, Guangdong, China. December 29, 2006. Size Balanced Tree Chen Qifeng (Farmer John) Zhonghan Memorial Middle School, Guangdong, China Email:44687@QQ.com December 9, 006 Abtract Thi paper preent a unique trategy for maintaining balance in dynamically

More information

An Intro to LP and the Simplex Algorithm. Primal Simplex

An Intro to LP and the Simplex Algorithm. Primal Simplex An Intro to LP and the Simplex Algorithm Primal Simplex Linear programming i contrained minimization of a linear objective over a olution pace defined by linear contraint: min cx Ax b l x u A i an m n

More information

A Linear Interpolation-Based Algorithm for Path Planning and Replanning on Girds *

A Linear Interpolation-Based Algorithm for Path Planning and Replanning on Girds * Advance in Linear Algebra & Matrix Theory, 2012, 2, 20-24 http://dx.doi.org/10.4236/alamt.2012.22003 Publihed Online June 2012 (http://www.scirp.org/journal/alamt) A Linear Interpolation-Baed Algorithm

More information

Diffraction I Version 1.0 : March 12, 2019

Diffraction I Version 1.0 : March 12, 2019 Diffraction I Interference an Diffraction of Light Through Slit: The Jut Give Me The Formulae Verion! Steve Smith March 12, 2019 Content 1 Introuction 3 1.1 Huygen Principle.............................................

More information

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013 Kevin Wayne. Last updated on Sep 8, :40 AM

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013 Kevin Wayne. Last updated on Sep 8, :40 AM 7. NETWORK FLOW I max-flow and min-cut problem Ford-Fulkeron algorithm max-flow min-cut theorem capacity-caling algorithm hortet augmenting path blocking-flow algorithm unit-capacity imple network Lecture

More information

Exploring Simple Grid Polygons

Exploring Simple Grid Polygons Exploring Simple Grid Polygon Chritian Icking 1, Tom Kamphan 2, Rolf Klein 2, and Elmar Langetepe 2 1 Univerity of Hagen, Praktiche Informatik VI, 58084 Hagen, Germany. 2 Univerity of Bonn, Computer Science

More information

This article appeared in a journal published by Elsevier. The attached copy is furnished to the author for internal non-commercial research and

This article appeared in a journal published by Elsevier. The attached copy is furnished to the author for internal non-commercial research and Thi article appeared in a journal publihed by Elevier. The attached copy i furnihed to the author for internal non-commercial reearch and education ue, including for intruction at the author intitution

More information

Trading Off Space for Passes in Graph Streaming Problems

Trading Off Space for Passes in Graph Streaming Problems Trading Off Space for Pae in Graph Streaming Problem CAMIL DEMETRESCU, IRENE FINOCCHI and ANDREA RIBICHINI Univerità di Roma La Sapienza, Roma, Italy Data tream proceing ha recently received increaing

More information

The norm Package. November 15, Title Analysis of multivariate normal datasets with missing values

The norm Package. November 15, Title Analysis of multivariate normal datasets with missing values The norm Package November 15, 2003 Verion 1.0-9 Date 2002/05/06 Title Analyi of multivariate normal dataet with miing value Author Ported to R by Alvaro A. Novo . Original by Joeph

More information

Cutting Stock by Iterated Matching. Andreas Fritsch, Oliver Vornberger. University of Osnabruck. D Osnabruck.

Cutting Stock by Iterated Matching. Andreas Fritsch, Oliver Vornberger. University of Osnabruck. D Osnabruck. Cutting Stock by Iterated Matching Andrea Fritch, Oliver Vornberger Univerity of Onabruck Dept of Math/Computer Science D-4909 Onabruck andy@informatikuni-onabrueckde Abtract The combinatorial optimization

More information

Lemma 1. A 3-connected maximal generalized outerplanar graph is a wheel.

Lemma 1. A 3-connected maximal generalized outerplanar graph is a wheel. 122 (1997) MATHEMATICA BOHEMICA No. 3, 225{230 A LINEAR ALGORITHM TO RECOGNIZE MAXIMAL GENERALIZED OUTERPLANAR GRAPHS Jo C cere, Almer a, Alberto M rquez, Sevilla (Received November 16, 1994, revied May

More information

Shortest-Path Routing in Arbitrary Networks

Shortest-Path Routing in Arbitrary Networks Ž. Journal of Algorithm 31, 105131 1999 Article ID jagm.1998.0980, available online at http:www.idealibrary.com on Shortet-Path Routing in Arbitrary Network Friedhelm Meyer auf der Heide and Berthold Vocking

More information

See chapter 8 in the textbook. Dr Muhammad Al Salamah, Industrial Engineering, KFUPM

See chapter 8 in the textbook. Dr Muhammad Al Salamah, Industrial Engineering, KFUPM Goal programming Objective of the topic: Indentify indutrial baed ituation where two or more objective function are required. Write a multi objective function model dla a goal LP Ue weighting um and preemptive

More information

Cut Tree Construction from Massive Graphs

Cut Tree Construction from Massive Graphs Cut Tree Contruction from Maive Graph Takuya Akiba Yoichi Iwata Youke Samehima # Naoto Mizuno Youke Yano # Preferred Network, Inc. National Intitute of Informatic # Recruit Holding Co., Ltd. The Univerity

More information

Control Flow Analysis

Control Flow Analysis Control Flow Analyi Efficiency Control Flow Analyi Type an Effect ytem Data Flow Analyi Abtract Interpretation Correctne Control Flow Analyi p.1/35 Control Flow Analyi Flow information i eential for the

More information

Dijkstra s Shortest Path Algorithm

Dijkstra s Shortest Path Algorithm Dijkstra s Shortest Path Algorithm DPV 4.4, CLRS 24.3 Revised, October 23, 2014 Outline of this Lecture Recalling the BFS solution of the shortest path problem for unweighted (di)graphs. The shortest path

More information

Using Partial Evaluation in Distributed Query Evaluation

Using Partial Evaluation in Distributed Query Evaluation A X x Z z R r y Y B Uing Partial Evaluation in Ditributed Query Evaluation Peter Buneman Gao Cong Univerity of Edinburgh Wenfei Fan Univerity of Edinburgh & Bell Laboratorie Anataio Kementietidi Univerity

More information

Variable Resolution Discretization in the Joint Space

Variable Resolution Discretization in the Joint Space Variable Reolution Dicretization in the Joint Space Chritopher K. Monon, David Wingate, and Kevin D. Seppi {c,wingated,keppi}@c.byu.edu Computer Science, Brigham Young Univerity Todd S. Peteron peterto@uvc.edu

More information

Drawing Lines in 2 Dimensions

Drawing Lines in 2 Dimensions Drawing Line in 2 Dimenion Drawing a traight line (or an arc) between two end point when one i limited to dicrete pixel require a bit of thought. Conider the following line uperimpoed on a 2 dimenional

More information

The Euler Tour Technique and Parallel Rooted Spanning Tree

The Euler Tour Technique and Parallel Rooted Spanning Tree The Euler Tour Technique and Parallel Rooted Spanning Tree Guojing Cong, David A. Bader Department of Electrical and Computer Engineering Univerity of New Mexico, Albuquerque, NM 87131 USA {cong, dbader}@ece.unm.edu

More information

Multicast with Network Coding in Application-Layer Overlay Networks

Multicast with Network Coding in Application-Layer Overlay Networks IEEE JOURNAL ON SELECTED AREAS IN COMMUNICATIONS, VOL. 22, NO. 1, JANUARY 2004 1 Multicat with Network Coding in Application-Layer Overlay Network Ying Zhu, Baochun Li, Member, IEEE, and Jiang Guo Abtract

More information

Nearly Constant Approximation for Data Aggregation Scheduling in Wireless Sensor Networks

Nearly Constant Approximation for Data Aggregation Scheduling in Wireless Sensor Networks Nearly Contant Approximation for Data Aggregation Scheduling in Wirele Senor Network Scott C.-H. Huang, Peng-Jun Wan, Chinh T. Vu, Yinghu Li and France Yao Computer Science Department, City Univerity of

More information

Week 12: Minimum Spanning trees and Shortest Paths

Week 12: Minimum Spanning trees and Shortest Paths Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601

More information

Edits in Xylia Validity Preserving Editing of XML Documents

Edits in Xylia Validity Preserving Editing of XML Documents dit in Xylia Validity Preerving diting of XML Document Pouria Shaker, Theodore S. Norvell, and Denni K. Peter Faculty of ngineering and Applied Science, Memorial Univerity of Newfoundland, St. John, NFLD,

More information

The Association of System Performance Professionals

The Association of System Performance Professionals The Aociation of Sytem Performance Profeional The Computer Meaurement Group, commonly called CMG, i a not for profit, worldwide organization of data proceing profeional committed to the meaurement and

More information

Programmazione di sistemi multicore

Programmazione di sistemi multicore Programmazione di itemi multicore A.A. 2015-2016 LECTURE 9 IRENE FINOCCHI http://wwwuer.di.uniroma1.it/~inocchi/ More complex parallel pattern PARALLEL PREFIX PARALLEL SORTING PARALLEL MERGESORT PARALLEL

More information

Minimum Energy Reliable Paths Using Unreliable Wireless Links

Minimum Energy Reliable Paths Using Unreliable Wireless Links Minimum Energy Reliable Path Uing Unreliable Wirele Link Qunfeng Dong Department of Computer Science Univerity of Wiconin-Madion Madion, Wiconin 53706 qunfeng@c.wic.edu Micah Adler Department of Computer

More information

AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROBLEM

AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROBLEM RAC Univerity Journal, Vol IV, No, 7, pp 87-9 AN ALGORITHM FOR RESTRICTED NORMAL FORM TO SOLVE DUAL TYPE NON-CANONICAL LINEAR FRACTIONAL PROGRAMMING PROLEM Mozzem Hoain Department of Mathematic Ghior Govt

More information

A Multi-objective Genetic Algorithm for Reliability Optimization Problem

A Multi-objective Genetic Algorithm for Reliability Optimization Problem International Journal of Performability Engineering, Vol. 5, No. 3, April 2009, pp. 227-234. RAMS Conultant Printed in India A Multi-objective Genetic Algorithm for Reliability Optimization Problem AMAR

More information

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations:

Gray-level histogram. Intensity (grey-level) transformation, or mapping. Use of intensity transformations: Faculty of Informatic Eötvö Loránd Univerity Budapet, Hungary Lecture : Intenity Tranformation Image enhancement by point proceing Spatial domain and frequency domain method Baic Algorithm for Digital

More information

Bottom Up parsing. Bottom-up parsing. Steps in a shift-reduce parse. 1. s. 2. np. john. john. john. walks. walks.

Bottom Up parsing. Bottom-up parsing. Steps in a shift-reduce parse. 1. s. 2. np. john. john. john. walks. walks. Paring Technologie Outline Paring Technologie Outline Bottom Up paring Paring Technologie Paring Technologie Bottom-up paring Step in a hift-reduce pare top-down: try to grow a tree down from a category

More information

DAROS: Distributed User-Server Assignment And Replication For Online Social Networking Applications

DAROS: Distributed User-Server Assignment And Replication For Online Social Networking Applications DAROS: Ditributed Uer-Server Aignment And Replication For Online Social Networking Application Thuan Duong-Ba School of EECS Oregon State Univerity Corvalli, OR 97330, USA Email: duongba@eec.oregontate.edu

More information

CSE 250B Assignment 4 Report

CSE 250B Assignment 4 Report CSE 250B Aignment 4 Report March 24, 2012 Yuncong Chen yuncong@c.ucd.edu Pengfei Chen pec008@ucd.edu Yang Liu yal060@c.ucd.edu Abtract In thi project, we implemented the recurive autoencoder (RAE) a decribed

More information

The Set Constraint/CFL Reachability Connection in Practice

The Set Constraint/CFL Reachability Connection in Practice The Set Contraint/CFL Reachability Connection in Practice John Kodumal EECS Department Univerity of California, Berkeley jkodumal@c.berkeley.edu Alex Aiken Computer Science Department Stanford Univerity

More information

Laboratory Exercise 6

Laboratory Exercise 6 Laboratory Exercie 6 Adder, Subtractor, and Multiplier The purpoe of thi exercie i to examine arithmetic circuit that add, ubtract, and multiply number. Each circuit will be decribed in Verilog and implemented

More information

Part 1 A New Number Format: The Unum

Part 1 A New Number Format: The Unum Part 1 yr op A New Number Format: The Unum ht ig 1 Overview l- ia er at M or yl Ta an Fr ci You can t boil the ocean. Former Intel executive, reacting to the idea of unum. Incidentally, the pronunciation

More information

Motivation: Level Sets. Input Data Noisy. Easy Case Use Marching Cubes. Intensity Varies. Non-uniform Exposure. Roger Crawfis

Motivation: Level Sets. Input Data Noisy. Easy Case Use Marching Cubes. Intensity Varies. Non-uniform Exposure. Roger Crawfis Level Set Motivation: Roger Crawfi Slide collected from: Fan Ding, Charle Dyer, Donald Tanguay and Roger Crawfi 4/24/2003 R. Crawfi, Ohio State Univ. 109 Eay Cae Ue Marching Cube Input Data Noiy 4/24/2003

More information

Online Motion Planning

Online Motion Planning RHEINISCHE FRIEDRICH-WILHELMS-UNIVERSITÄT BONN INSTITUT FÜR INFORMATIK I Elmar Langetepe Online Motion Planning MA INF 1314 Summeremeter 017 Manucript: c Elmar Langetepe CONTENTS Content 1 Labyrinth,

More information

SECTOR BASED MULTICAST ROUTING ALGORITHM FOR MOBILE AD-HOC NETWORKS

SECTOR BASED MULTICAST ROUTING ALGORITHM FOR MOBILE AD-HOC NETWORKS SECTOR BASED MULTICAST ROUTING ALGORITHM OR MOBILE AD-HOC NETWORKS Murali Paramewaran 1 and Chittaranjan Hota 2 1 Department of Computer Science & Information Sytem, BITS-Pilani, Pilani, India 2 Department

More information

A Boyer-Moore Approach for. Two-Dimensional Matching. Jorma Tarhio. University of California. Berkeley, CA Abstract

A Boyer-Moore Approach for. Two-Dimensional Matching. Jorma Tarhio. University of California. Berkeley, CA Abstract A Boyer-Moore Approach for Two-Dimenional Matching Jorma Tarhio Computer Science Diviion Univerity of California Berkeley, CA 94720 Abtract An imple ublinear algorithm i preented for two-dimenional tring

More information

Now consider the following situation after deleting three elements from the queue...

Now consider the following situation after deleting three elements from the queue... Scheme of valuvation -1I Subject & Code : Data Structure and Application (15CS33) NOTE: ANSWER All FIVE QUESTIONS 1 Explain the diadvantage of linear queue and how it i olved in circular queue. Explain

More information

Shortest Path Algorithms

Shortest Path Algorithms Shortest Path Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Single Source Shortest Path Given: a directed or undirected graph G = (V,E) a source node s in V a weight function w: E

More information

New Structural Decomposition Techniques for Constraint Satisfaction Problems

New Structural Decomposition Techniques for Constraint Satisfaction Problems 113 New Structural Decompoition Technique for Contraint Satifaction Problem Yaling Zheng and Berthe Y. Choueiry Contraint Sytem Laboratory, Univerity of Nebraka-Lincoln {yzheng,choueiry}@ce.unl.edu Abtract.

More information

Theory of Computing. Lecture 7 MAS 714 Hartmut Klauck

Theory of Computing. Lecture 7 MAS 714 Hartmut Klauck Theory of Computing Lecture 7 MAS 714 Hartmut Klauck Shortest paths in weighted graphs We are given a graph G (adjacency list with weights W(u,v)) No edge means W(u,v)=1 We look for shortest paths from

More information

Performance of a Robust Filter-based Approach for Contour Detection in Wireless Sensor Networks

Performance of a Robust Filter-based Approach for Contour Detection in Wireless Sensor Networks Performance of a Robut Filter-baed Approach for Contour Detection in Wirele Senor Network Hadi Alati, William A. Armtrong, Jr., and Ai Naipuri Department of Electrical and Computer Engineering The Univerity

More information

Growing Networks Through Random Walks Without Restarts

Growing Networks Through Random Walks Without Restarts Growing Network Through Random Walk Without Retart Bernardo Amorim, Daniel Figueiredo, Giulio Iacobelli, Giovanni Neglia To cite thi verion: Bernardo Amorim, Daniel Figueiredo, Giulio Iacobelli, Giovanni

More information