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

Size: px
Start display at page:

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

Transcription

1 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 turn left on the road to Bennett Lake until...no, that won t work either. Eat Millinocket, ya ay? Come to think of it, you can t get there from here. Hey farmer! Where doe thi road go? Been livin here all my life, it ain t gone nowhere yet. Hey farmer! How do you get to Little Rock? Liten tranger, you can t get there from here. Hey farmer! You don t know very much do you? No, but I ain t lot. Robert Bryan and Marhall Dodge, Bert and I and Other Storie from Down Eat (96) Michelle Shocked, Arkana Traveler (99) CHAPTER Shortet Path Thi i the Spring 06 reviion in the new kin; it till need ignificant reviion. In particular, everal figure need to be redrawn in OmniGraffle.. Introduction Suppoe we are given a weighted directed graph G = (V, E, w) with two pecial vertice, and we want to find the hortet path from a ource vertex to a target vertex t. That i, we want to find the directed path p tarting at and ending at t that minimize the function w(p) := w(u v). u v p For example, if I want to anwer the quetion What the fatet way to drive from my old apartment in Champaign, Illinoi to my wife old apartment in Columbu, Ohio?, I might ue a graph whoe vertice are citie, edge are road, weight are driving time, Copyright 0 Jeff Erickon. Thi work i licened under a Creative Common Licene ( Free ditribution i trongly encouraged; commercial ditribution i exprely forbidden. See for the mot recent reviion.

2 . SHORTEST PATHS i Champaign, and t i Columbu.¹ The graph i directed, becaue driving time along the ame road might be different in different direction. (At one time, there wa a peed trap on I-0 jut eat of the Indiana/Ohio border, but only for eatbound traffic.) Perhap counter to intuition, we will allow the weight on the edge to be negative. Negative edge make our live complicated, becaue the preence of a negative cycle might imply that there i no hortet path. In general, a hortet path from to t exit if and only if there i at leat one path from to t, but there i no path from to t that touche a negative cycle. If any negative cycle i reachable from and can reach t, we can alway find a horter path by going around the cycle one more time. I m abuing terminology here; by definition, a path cannot repeat vertice. Negative cycle mean that there may be no hortet walk from to t. A long a t i reach able from, there i alway a hortet path; it jut NP-hard to compute. On the other hand, if there i a hortet walk from to t, that walk i in fact a path, and therefore the hortet path, from to t. Blerg. 5 t Figure.. There i no hortet path from to t. Almot every algorithm known for olving thi problem actually olve (large portion of) 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. It not hard to ee that if hortet path are unique, then they form a tree, becaue any ubpath of a hortet path i itelf a hortet path. If there are multiple hortet path to ome vertice, we can alway chooe one hortet path to each vertex o that the union of the path i a tree. If there are hortet path to two vertice u and v that diverge, then meet, then diverge again, we can modify one of the path without changing it length o that the two path only diverge once. Although they are both optimal panning tree, hortet-path tree and minimum panning tree are very different creature. Shortet-path tree are rooted and directed; minimum panning tree are unrooted and undirected. Shortet-path tree are mot naturally defined for directed graph; only undirected graph have minimum panning tree. If edge weight are ditinct, there i only one minimum panning tree, but every Wet on Church, north on Propect, eat on I-, outh on I-65, eat on Airport Expreway, north on I-65, eat on I-0, north on Grandview, eat on 5th, north on Olentangy River, eat on Dodridge, north on High, wet on Kelo, outh on Neil. Depending on traffic. We both live in Urbana now.

3 .. Warning! b c u a d x y v Figure.. If a b c d v and a x y d u are hortet path, then a b c d u i alo a hortet path. ource vertex induce a different hortet-path tree; moreover, it i poible for every hortet path tree to ue a different et of edge from the minimum panning tree Figure.. A minimum panning tree and a hortet path tree (rooted at the top vertex) of the ame undirected graph.. Warning! Throughout thi chapter, we will explicitly conider only directed graph. All of the algorithm decribed in thi lecture alo work for undirected graph with ome minor modification, but only if negative edge are prohibited. Dealing with negative edge in undirected graph i coniderably more ubtle. We cannot imply replace every undirected edge with a pair of directed edge, becaue thi would tranform any negative edge into a hort negative cycle. Subpath of an undirected hortet path that contain a negative edge are not necearily hortet path; conequently, the et of all undirected hortet path from a ingle ource vertex may not define a tree, even if hortet path are unique. u v u v u v An undirected graph where hortet path from are unique but do not define a tree. A complete treatment of undirected graph with negative edge i beyond the cope of thi chapter, or even the entire book. I will only mention, for people who want to

4 . SHORTEST PATHS follow up via Google, that a ingle hortet path in an undirected graph with negative edge can be computed in O(V E + V log V ) time, by a reduction to maximum weighted matching.. The Only SSSP Algorithm Jut like graph traveral and minimum panning tree, there are everal different SSSP algorithm, but they are all pecial cae of the a ingle generic algorithm, firt propoed by Leter Ford in 956, and independently by George Dantzig in 95.² Each vertex v in the graph tore two value, which (inductively) decribe a tentative hortet path from to v. dit(v) i the length of the tentative hortet v path, or if there i no uch path. pred(v) i the predeceor of v in the tentative hortet v path, or Null if there i no uch vertex. In fact, the predeceor pointer automatically define a tentative hortet path tree; they play exactly the ame role a the parent pointer in our generic graph traveral algorithm. At the beginning of the algorithm, we already know that dit() = 0 and pred() = Null. For every vertex v, we initially et dit(v) = and pred(v) = Null to indicate that we do not know of any path from to v. During the execution of the algorithm, we call an edge u v tene if dit(u)+w(u v) < dit(v). If u v i tene, the tentative hortet path v i clearly incorrect, becaue the path u v i horter. Our generic algorithm repeatedly find a tene edge in the graph and relaxe it: Relax(u v): dit(v) dit(u) + w(u v) pred(v) u When there are no tene edge, the algorithm halt, and we have our deired hortet path tree. The correctne of Ford generic relaxation algorithm follow from the following erie of claim:. For every vertex v, the ditance dit(v) i either or the length of ome walk from to v. Thi claim can be proved by induction on the number of relaxation.. If the graph ha no negative cycle, then dit(v) i either or the length of ome imple path from to v. Specifically, if dit(v) i the length of a walk from to v that contain a directed cycle, that cycle mut have negative weight. Thi claim implie that if G ha no negative cycle, the relaxation algorithm eventually halt, becaue there are only a finite number of imple path in G. Specifically, Dantzig howed that the hortet path problem can be phraed a a linear programming problem, and then decribed an interpretation of hi implex method in term of the original graph. Hi decription i equivalent to Ford relaxation trategy.

5 .. Bet-Firt: Dijktra Algorithm. If no edge in G i tene, then for every vertex v, the ditance dit(v) i the length of the predeceor path pred(pred(v)) pred(v) v. Specifically, if v violate thi condition but it predeceor pred(v) doe not, the edge pred(v) v i tene.. If no edge in G i tene, then for every vertex v, the path of predeceor edge pred(pred(v)) pred(v) v i a hortet path from to v. Specifically, if v violate thi condition but it predeceor u in ome hortet path doe not, the edge u v i tene. Thi claim alo implie that if the G ha a negative cycle, then ome edge i alway tene, o the generic algorithm never halt. So far I haven t aid anything about how we detect which edge can be relaxed, or in what order we relax them. To make thi eaier, we refine the relaxation algorithm lightly, into omething cloely reembling the generic graph traveral algorithm. We maintain a bag of vertice, initially containing jut the ource vertex. Whenever we take a vertex u from the bag, we can all of it outgoing edge, looking for omething to relax. Finally, whenever we uccefully relax an edge u v, we put v into the bag. Unlike our generic graph traveral algorithm, we do not mark vertice when we viit them; the ame vertex could be viited many time, and the ame edge could be relaxed many time. InitSSSP(): dit() 0 pred() Null for all vertice v dit(v) pred(v) Null 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, different bag data tructure for the give u different algorithm. There are three obviou choice to try: a tack, a queue, and a priority queue. Unfortunately, if we ue a tack, the reulting algorithm perform Θ( V ) relaxation tep in the wort cae! (Proving thi i a good homework problem.) The other two poibilitie are much more efficient.. Bet-Firt: Dijktra Algorithm If we implement the bag uing a priority queue, where the key of a vertex v i it tentative ditance dit(v), we obtain an algorithm firt publihed in 95 by a team of reearcher at the Cae Intitute of Technology, in an annual project report for the Combat Development Department of the US Army Electronic Proving Ground. The 5

6 . SHORTEST PATHS ame algorithm wa later independently redicovered and actually publicly publihed by Edger Dijktra in 959. A nearly identical algorithm wa alo decribed by George Dantzig in 95. Dijktra algorithm, a it i univerally known³, i particularly well-behaved 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); if we ue a regular binary heap, the running time i O(E log V). Thi analyi aume that no edge ha negative weight. Dijktra algorithm (in the form I m preenting here⁴) i till correct if there are negative edge, but the wort-cae running time could be exponential. (Proving thi unfortunate fact i a good homework problem.) On the other hand, in practice, Dijktra algorithm i uually quite fat even for graph with negative edge..5 Breadth-Firt: Bellman-Ford If we replace the heap in Dijktra algorithm with a FIFO queue, we obtain an algorithm firt ketched by Shimbel in 95, decribed in more detail by Moore in 95, then independently redicovered by Woodbury and Dantzig in 95 and again by Bellman in 95. In full compliance with Stigler Law, the algorithm i almot univerally known a Bellman-Ford, becaue Bellman explicitly ued Ford formulation of relaxing edge, although a few early ource refer to Bellman-Shimbel. Bellman-Ford i efficient even if there are negative edge, and it can be ued to quickly detect the preence of negative cycle. If there are no negative edge, however, Dijktra algorithm i fater. (In fact, in practice, Dijktra algorithm i often fater even for graph with negative edge.) The eaiet way to analyze the algorithm i to break the execution into phae, by introducing an imaginary token. Before we even begin, we inert the token into the queue. The current phae end when we take the token out of the queue; we begin the I will follow thi common convention, depite the hitorical inaccuracy, partly becaue I don t think anybody want to read about the Leyzorek-Gray-Johnon-Ladew-Meaker-Petry-Seitz algorithm, and partly becaue paper that aren t actually publically publihed don t count. Mot algorithm textbook, Wikipedia, and even Dijktra original paper preent a verion of Dijktra algorithm that give incorrect reult for graph with negative edge, becaue it never viit the ame vertex more than once. Thi i alo the verion of Dijktra algorithm that I decribed a bet-firt earch in Chapter 5. Here I ve taken the liberty of correcting Dijktra mitake. Even Dijktra would agree that a correct algorithm that i ometime low (and in practice, rarely low) i better than a fat algorithm that doen t alway work. 6

7 .5. Breadth-Firt: Bellman-Ford Figure.. 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 jut been canned. The bold edge decribe the evolving hortet path tree. next phae by reinerting the token into the queue. The 0th phae conit entirely of canning the ource vertex. The algorithm end when the queue contain only the token. A imple inductive argument (hint, hint) implie the following invariant for every integer i and vertex v: After i phae of the algorithm, dit(v) i at mot the length of the hortet walk from to v coniting of at mot i edge. Include the induction proof. Since a hortet path can only pa through each vertex once, either the algorithm halt before the V th phae, or the graph contain a negative cycle. In each phae, we can each vertex at mot once, o we relax each edge at mot once, o the running time of a ingle phae i O(E). Thu, the overall running time of Bellman-Ford i O(VE). Once we undertand how the phae of Bellman-Ford behave, we can implify the algorithm coniderably by producing the ame behavior on purpoe (following the ame deign pattern that we advocated for dynamic programming in Chapter ). Intead of performing a partial breadth-firt earch of the graph in each phae, we can imply can through the adjacency lit directly, relaxing every tene edge we find in the graph.

8 . SHORTEST PATHS d e b f d e b f d e b f a 0 d 6 c a e 9 b f 0 6 c a d f e 9 b 0 c a 0 c a 0 c Figure.5. Four phae of Bellman-Ford run on a directed graph with negative edge. Node are taken from the queue in the order a b c d f b a e d d a, where i the end-of-phae token. Shaded vertice are in the queue at the end of each phae. The bold edge decribe the evolving hortet path tree. Shimbel-Moore-Woodbury-Dantzig-Bellman-Ford-Broh: Relax ALL the tene edge and recure. BellmanFordSSSP() InitSSSP() repeat V time: for every edge u v if u v i tene Relax(u v) for every edge u v if u v i tene return Negative cycle! Thi i how mot textbook preent the Bellman-Ford algorithm.⁵ The O(V E) running 5 In fact, thi i eentially the formulation propoed by both Shimbel and Bellman. Bob Tarjan

9 .6. Dynamic Programming: Bellman-Ford Again time of thi formulation of the algorithm hould be obviou, but it may be le clear that the algorithm i till correct. In fact, correctne follow from exactly the ame invariant a before: After i phae of the algorithm, dit(v) i at mot the length of the hortet walk from to v coniting of at mot i edge. A before, it i traightforward to prove by induction (hint, hint) that thi invariant hold for every integer i and vertex v..6 Dynamic Programming: Bellman-Ford Again Like everything ele with Richard Bellman name on it, Bellman-Ford can alo be recat a a dynamic programming algorithm. Let dit i (v) denote the length of the hortet path v coniting of at mot i edge. It not hard to ee that thi function obey the following Bellman equation recurrence: 0 if i = 0 and v = if i = 0 and v dit i (v) = dit i (v), min min (dit otherwie i (u) + w(u v)) u v E For the moment, let aume the graph ha no negative cycle; our goal i to compute dit V (t). A traightforward dynamic-programming evaluation of thi recurrence look like thi: BellmanFordDP() dit[0, ] 0 for every vertex v dit[0, v] for i to V for every vertex v dit[i, v] dit[i, v] for every edge u v if dit[i, v] > dit[i, u] + w(u v) dit[i, v] dit[i, u] + w(u v) Now let u make two minor change to thi algorithm. Firt, we remove one level of indentation from the lat three line. Thi may change the order in which we examine edge, but the modified algorithm till compute dit i (v) for all i and v. Second, we recognized in the early 90 that Bellman-Ford i equivalent to Dijktra algorithm with a queue intead of a heap. 9

10 . SHORTEST PATHS change the indice in the lat two line from i to i. Thi change may caue the ditance dit[i, v] to approach the true hortet-path ditance more quickly than before, but the algorithm i till correct. BellmanFordDP() dit[0, ] 0 for every vertex v dit[0, v] for i to V for every vertex v dit[i, v] dit[i, v] for every edge u v if dit[i, v] > dit[i, u] + w(u v) dit[i, v] dit[i, u] + w(u v) Now notice that the iteration index i i completely redundant! We really only need to keep a one-dimenional array of ditance, which mean we don t need to can the vertice in each iteration of the main loop. BellmanFordDP() dit[] 0 for every vertex v dit[v] for i to V for every edge u v if dit[v] > dit[u] + w(u v) dit[v] dit[u] + w(u v) The reulting algorithm i almot identical to our earlier algorithm BellmanFordSSSP! The firt three line initialize the hortet path ditance, and the lat two line check whether an edge i tene, and if o, relaxe it. The only feature miing from the new algorithm i explicit maintenance of predeceor, but that eay to add. Exercie Need more!. Prove that the following invariant hold for every integer i and every vertex v: After i phae of Bellman-Ford (in either formulation), dit(v) i at mot the length of the hortet path v coniting of at mot i edge.. Let G be a directed graph with edge weight (which may be poitive, negative, or zero), and let be an arbitrary vertex of G. 0

11 Exercie (a) Suppoe every vertex v tore a number dit(v). Decribe and analyze an algorithm to determine whether dit(v) i the hortet-path ditance from to v, for every vertex v. (b) Suppoe intead that every vertex v tore a pointer pred(v) to another vertex in G. Decribe and analyze an algorithm to determine whether thee predeceor pointer define a ingle-ource hortet path tree rooted at. Do not aume that G contain no negative cycle.. A looped tree i a weighted, directed graph built from a binary tree by adding an edge from every leaf back to the root. Every edge ha a non-negative weight A looped tree. (a) How much time would Dijktra algorithm require to compute the hortet path between two vertice u and v in a looped tree with n node? (b) Decribe and analyze a fater algorithm.. Suppoe we are given a directed graph G with weighted edge and two vertice and t. (a) Decribe and analyze an algorithm to find the hortet path from to t when exactly one edge in G ha negative weight. (b) Decribe and analyze an algorithm to find the hortet path from to t when exactly k edge in G have negative weight. How doe the running time of your algorithm depend on k? 5. Suppoe we are given an undirected graph G in which every vertex ha a poitive weight. (a) Decribe and analyze an algorithm to find a panning tree of G with minimum total weight. (The total weight of a panning tree i the um of the weight of it vertice.) (b) Decribe and analyze an algorithm to find a path in G from one given vertex to another given vertex t with minimum total weight. (The total weight of a path i the um of the weight of it vertice.)

12 . SHORTEST PATHS [Hint: One of thee problem i trivial.] 6. For any edge e in any graph G, let G \ e denote the graph obtained by deleting e from G. (a) Suppoe we are given a directed graph G in which the hortet path σ from vertex to vertex t pae through every vertex of G. Decribe an algorithm to compute the hortet-path ditance from to t in G \ e, for every edge e of G, in O(E log V ) time. Your algorithm hould output a et of E hortet-path ditance, one for each edge of the input graph. You may aume that all edge weight are non-negative. [Hint: If we delete an edge of the original hortet path, how do the old and new hortet path overlap?] (b) Let and t be arbitrary vertice in an arbitrary undirected graph G. Decribe an algorithm to compute the hortet-path ditance from to t in G \ e, for every edge e of G, in O(E log V ) time. Again, you may aume that all edge weight are non-negative.. Let G = (V, E) be a connected directed graph with non-negative edge weight, let and t be vertice of G, and let H be a ubgraph of G obtained by deleting ome edge. Suppoe we want to reinert exactly one edge from G back into H, o that the hortet path from to t in the reulting graph i a hort a poible. Decribe and analyze an algorithm that chooe the bet edge to reinert, in O(E log V ) time.. When there i more than one hortet path from one node to another node t, it i often convenient to chooe a hortet path with the fewet edge; call thi the bet path from to t. Suppoe we are given a directed graph G with poitive edge weight and a ource vertex in G. Decribe and analyze an algorithm to compute bet path in G from to every other vertex. 9. (a) Prove that Ford generic hortet-path algorithm (while the graph contain a tene edge, relax it) can take exponential time in the wort cae when implemented with a tack intead of a priority queue (like Dijktra) or a queue (like Bellman- Ford). Specifically, for every poitive integer n, contruct a weighted directed n-vertex graph G n, uch that the tack-baed hortet-path algorithm call Relax Ω( n ) time when G n i the input graph. [Hint: Tower of Hanoi.] (b) Prove that Dijktra hortet-path algorithm can require exponential time in the wort cae when edge are allowed to have negative weight. Specifically, for every poitive integer n, contruct a weighted directed n-vertex graph G n, uch that Dijktra algorithm call Relax Ω( n ) time when G n i the input graph. [Hint: Thi i relatively eay if you ve already olved part (a).] 0. (a) Decribe and analyze a modification of the Bellman-Ford hortet-path algorithm that actually return a negative cycle if any uch cycle i reachable from, or a

13 Exercie hortet-path tree if there i no uch cycle. The modified algorithm hould till run in O(V E) time. (b) Decribe and analyze a modification of Bellman-Ford that compute the correct hortet path ditance from to every other vertex of the input graph, even if the graph contain negative cycle. Specifically, if any walk from to v contain a negative cycle, your algorithm hould end with dit(v) = ; otherwie, dit(v) hould contain the length of the hortet path from to v. The modified algorithm hould till run in O(V E) time. (c) Repeat part (a) and (b), but for Ford generic hortet-path algorithm. You may aume that the unmodified algorithm halt in O( V ) tep if there i no negative cycle; your modified algorithm hould alo run in O( V ) time.. Although we typically peak of the hortet path between two node, a ingle graph could contain everal minimum-length path with the ame endpoint Four (of many) equal-length hortet path. Decribe and analyze an algorithm to determine the number of hortet path from a ource vertex to a target vertex t in an arbitrary directed graph G with weighted edge. You may aume that all edge weight are poitive and that all neceary arithmetic operation can be performed in O() time. [Hint: Compute hortet path ditance from to every other vertex. Throw away all edge that cannot be part of a hortet path from to another vertex. What left?]. You jut dicovered your bet friend from elementary chool on Twitbook. You both want to meet a oon a poible, but you live in two different cite that are far apart. To minimize travel time, you agree to meet at an intermediate city, and then you imultaneouly hop in your car and tart driving toward each other. But where exactly hould you meet? You are given a weighted graph G = (V, E), where the vertice V repreent citie and the edge E repreent road that directly connect citie. Each edge e ha a weight w(e) equal to the time required to travel between the two citie. You are alo given a vertex p, repreenting your tarting location, and a vertex q, repreenting your friend tarting location. Decribe and analyze an algorithm to find the target vertex t that allow you and your friend to meet a quickly a poible.

14 . SHORTEST PATHS. After moving to a new city, you decide to chooe a walking route from your home to your new office. To get a good daily workout, your route mut conit of an uphill path (for exercie) followed by a downhill path (to cool down), or jut an uphill path, or jut a downhill path. (You ll walk the ame path home, o you ll get exercie one way or the other.) But you alo want the hortet path that atifie thee condition, o that you actually get to work on time. Your input conit of an undirected graph G, whoe vertice repreent interection and whoe edge repreent road egment, along with a tart vertex and a target vertex t. Every vertex v ha a value h(v), which i the height of that interection above ea level, and each edge uv ha a value l(uv), which i the length of that road egment. (a) Decribe and analyze an algorithm to find the hortet uphill downhill walk from to t. Aume all vertex height are ditinct. (b) Now uppoe we allow ome or all vertex height to be equal. Decribe and analyze an algorithm to find the hortet uphill downhill walk from to t; you may ue flat edge in both the uphill and downhill portion of your walk. (c) Finally, uppoe you dicover that there i no path from to t with the tructure you want. Decribe an algorithm to find a path from to t that alternate between uphill and downhill ubpath a few time a poible, and ha minimum length among all uch path.. After a grueling algorithm midterm, you decide to take the bu home. Since you planned ahead, you have a chedule that lit the time and location of every top of every bu in Champaign-Urbana. Unfortunately, there in t a ingle bu that viit both your exam building and your home; you mut tranfer between bu line at leat once. Decribe and analyze an algorithm to determine the equence of bu ride that will get you home a early a poible, auming there are b different bu line, and each bu top n time per day. Your goal i to minimize your arrival time, not the time you actually pend traveling. Aume that the bue run exactly on chedule, that you have an accurate watch, and that you are too tired to walk between bu top. 5. After graduating you accept a job with Aerophobe- -U, the leading traveling agency for people who hate to fly. Your job i to build a ytem to help cutomer plan airplane trip from one city to another. All of your cutomer are afraid of flying (and by extenion, airport), o any trip you plan need to be a hort a poible. You know all the departure and arrival time of all the flight on the planet. Suppoe one of your cutomer want to fly from city X to city Y. Decribe an algorithm to find a equence of flight that minimize the total time in tranit the length of time from the initial departure to the final arrival, including time at R

15 Exercie intermediate airport waiting for connecting flight. [Hint: Modify the input data and apply Dijktra algorithm.] 6. Mulder and Scully have computed, for every road in the United State, the exact probability that omeone driving on that road won t be abducted by alien. Agent Mulder need to drive from Langley, Virginia to Area 5, Nevada. What route hould he take o that he ha the leat chance of being abducted? More formally, you are given a directed graph G = (V, E), where every edge e ha an independent afety probability p(e). The afety of a path i the product of the afety probabilitie of it edge. Deign and analyze an algorithm to determine the afet path from a given tart vertex to a given target vertex t. La Vega, NV Memphi, TN Langley, VA Area 5, AZ For example, with the probabilitie hown above, if Mulder trie to drive directly from Langley to Area 5, he ha a 50% chance of getting there without being abducted. If he top in Memphi, he ha a = 6% chance of arriving afely. If he top firt in Memphi and then in La Vega, he ha a = 96.5% chance of being abducted! (That how they got Elvi, you know.) Although thi example i a dag, your algorithm mut handle arbitrary directed graph.. On an overnight camping trip in Sunnydale National Park, you are woken from a retle leep by a cream. A you crawl out of your tent to invetigate, a terrified park ranger run out of the wood, covered in blood and clutching a crumpled piece of paper to hi chet. A he reache your tent, he gap, Get out... while... you..., thrut the paper into your hand, and fall to the ground. Checking hi pule, you dicover that the ranger i tone dead. You look down at the paper and recognize a map of the park, drawn a an undirected graph, where vertice repreent landmark in the park, and edge repreent trail between thoe landmark. (Trail tart and end at landmark and do not cro.) You recognize one of the vertice a your current location; everal vertice on the boundary of the map are labeled EXIT. On cloer examination, you notice that omeone (perhap the poor dead park ranger) ha written a real number between 0 and next to each vertex and each edge. A crawled note on the back of the map indicate that a number next to an edge i the probability of encountering a vampire along the correponding trail, 5

16 . SHORTEST PATHS and a number next to a vertex i the probability of encountering a vampire at the correponding landmark. (Vampire can t tand each other company, o you ll never ee more than one vampire on the ame trail or at the ame landmark.) The note warn you that tepping off the marked trail will reult in a low and painful death. You glance down at the corpe at your feet. Ye, hi death certainly looked painful. Wait, wa that a twitch? Are hi teeth getting longer? After driving a tent take through the undead ranger heart, you wiely decide to leave the park immediately. Decribe and analyze an efficient algorithm to find a path from your current location to an arbitrary EXIT node, uch that the total expected number of vampire encountered along the path i a mall a poible. Be ure to account for both the vertex probabilitie and the edge probabilitie! Randall Munroe, xkcd ( Reproduced under a Creative Common Attribution-NonCommercial.5 Licene 6 Copyright 0 Jeff Erickon. Thi work i licened under a Creative Common Licene ( Free ditribution i trongly encouraged; commercial ditribution i exprely forbidden. See for the mot recent reviion.

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

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

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 362, Lecture 19. DFS and BFS. Generic Traverse. BFS and DFS Wrapup Shortest Paths. Jared Saia University of New Mexico

Today s Outline. CS 362, Lecture 19. DFS and BFS. Generic Traverse. BFS and DFS Wrapup Shortest Paths. Jared Saia University of New Mexico 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)

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

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

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

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

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

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

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

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

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

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 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

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

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

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

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

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

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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

Exercise 4: Markov Processes, Cellular Automata and Fuzzy Logic

Exercise 4: Markov Processes, Cellular Automata and Fuzzy Logic Exercie 4: Marko rocee, Cellular Automata and Fuzzy Logic Formal Method II, Fall Semeter 203 Solution Sheet Marko rocee Theoretical Exercie. (a) ( point) 0.2 0.7 0.3 tanding 0.25 lying 0.5 0.4 0.2 0.05

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 VHL and implemented

More information

How to. write a paper. The basics writing a solid paper Different communities/different standards Common errors

How to. write a paper. The basics writing a solid paper Different communities/different standards Common errors How to write a paper The baic writing a olid paper Different communitie/different tandard Common error Reource Raibert eay My grammar point Article on a v. the Bug in writing Clarity Goal Conciene Calling

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

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

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

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

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

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

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

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

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

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

3D SMAP Algorithm. April 11, 2012

3D SMAP Algorithm. April 11, 2012 3D SMAP Algorithm April 11, 2012 Baed on the original SMAP paper [1]. Thi report extend the tructure of MSRF into 3D. The prior ditribution i modified to atify the MRF property. In addition, an iterative

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

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

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

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart.

Universität Augsburg. Institut für Informatik. Approximating Optimal Visual Sensor Placement. E. Hörster, R. Lienhart. Univerität Augburg à ÊÇÅÍÆ ËÀǼ Approximating Optimal Viual Senor Placement E. Hörter, R. Lienhart Report 2006-01 Januar 2006 Intitut für Informatik D-86135 Augburg Copyright c E. Hörter, R. Lienhart Intitut

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

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

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

Laboratory Exercise 6

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

More information

Maneuverable Relays to Improve Energy Efficiency in Sensor Networks

Maneuverable Relays to Improve Energy Efficiency in Sensor Networks Maneuverable Relay to Improve Energy Efficiency in Senor Network Stephan Eidenbenz, Luka Kroc, Jame P. Smith CCS-5, MS M997; Lo Alamo National Laboratory; Lo Alamo, NM 87545. Email: {eidenben, kroc, jpmith}@lanl.gov

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

Quadrilaterals. Learning Objectives. Pre-Activity

Quadrilaterals. Learning Objectives. Pre-Activity Section 3.4 Pre-Activity Preparation Quadrilateral Intereting geometric hape and pattern are all around u when we tart looking for them. Examine a row of fencing or the tiling deign at the wimming pool.

More information

Laboratory Exercise 2

Laboratory Exercise 2 Laoratory Exercie Numer and Diplay Thi i an exercie in deigning cominational circuit that can perform inary-to-decimal numer converion and inary-coded-decimal (BCD) addition. Part I We wih to diplay on

More information

A Fast Association Rule Algorithm Based On Bitmap and Granular Computing

A Fast Association Rule Algorithm Based On Bitmap and Granular Computing A Fat Aociation Rule Algorithm Baed On Bitmap and Granular Computing T.Y.Lin Xiaohua Hu Eric Louie Dept. of Computer Science College of Information Science IBM Almaden Reearch Center San Joe State Univerity

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

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

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

Problem Set 2 (Due: Friday, October 19, 2018)

Problem Set 2 (Due: Friday, October 19, 2018) Electrical and Computer Engineering Memorial Univerity of Newfoundland ENGI 9876 - Advanced Data Network Fall 2018 Problem Set 2 (Due: Friday, October 19, 2018) Quetion 1 Conider an M/M/1 model of a queue

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

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

Course Project: Adders, Subtractors, and Multipliers a

Course Project: Adders, Subtractors, and Multipliers a In the name Allah Department of Computer Engineering 215 Spring emeter Computer Architecture Coure Intructor: Dr. Mahdi Abbai Coure Project: Adder, Subtractor, and Multiplier a a The purpoe of thi p roject

More information

A Practical Model for Minimizing Waiting Time in a Transit Network

A Practical Model for Minimizing Waiting Time in a Transit Network A Practical Model for Minimizing Waiting Time in a Tranit Network Leila Dianat, MASc, Department of Civil Engineering, Sharif Univerity of Technology, Tehran, Iran Youef Shafahi, Ph.D. Aociate Profeor,

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

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

Select Operation (σ) It selects tuples that satisfy the given predicate from a relation (choose rows). Review : RELATIONAL ALGEBRA

Select Operation (σ) It selects tuples that satisfy the given predicate from a relation (choose rows). Review : RELATIONAL ALGEBRA Review : RELATIONAL ALGEBRA Relational databae ytem are expected to be equipped with a query language that can ait it uer to query the databae intance. There are two kind of query language relational algebra

More information

Representations and Transformations. Objectives

Representations and Transformations. Objectives Repreentation and Tranformation Objective Derive homogeneou coordinate tranformation matrice Introduce tandard tranformation - Rotation - Tranlation - Scaling - Shear Scalar, Point, Vector Three baic element

More information

Planning of scooping position and approach path for loading operation by wheel loader

Planning of scooping position and approach path for loading operation by wheel loader 22 nd International Sympoium on Automation and Robotic in Contruction ISARC 25 - September 11-14, 25, Ferrara (Italy) 1 Planning of cooping poition and approach path for loading operation by wheel loader

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

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

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

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

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

Motion Control (wheeled robots)

Motion Control (wheeled robots) 3 Motion Control (wheeled robot) Requirement for Motion Control Kinematic / dynamic model of the robot Model of the interaction between the wheel and the ground Definition of required motion -> peed control,

More information

An Approach to a Test Oracle for XML Query Testing

An Approach to a Test Oracle for XML Query Testing An Approach to a Tet Oracle for XML Query Teting Dae S. Kim-Park, Claudio de la Riva, Javier Tuya Univerity of Oviedo Computing Department Campu of Vieque, /n, 33204 (SPAIN) kim_park@li.uniovi.e, claudio@uniovi.e,

More information

On successive packing approach to multidimensional (M-D) interleaving

On successive packing approach to multidimensional (M-D) interleaving On ucceive packing approach to multidimenional (M-D) interleaving Xi Min Zhang Yun Q. hi ankar Bau Abtract We propoe an interleaving cheme for multidimenional (M-D) interleaving. To achieved by uing a

More information

Analysis of the results of analytical and simulation With the network model and dynamic priority Unchecked Buffer

Analysis of the results of analytical and simulation With the network model and dynamic priority Unchecked Buffer International Reearch Journal of Applied and Baic Science 218 Available online at www.irjab.com ISSN 2251-838X / Vol, 12 (1): 49-53 Science Explorer Publication Analyi of the reult of analytical and imulation

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

Hassan Ghaziri AUB, OSB Beirut, Lebanon Key words Competitive self-organizing maps, Meta-heuristics, Vehicle routing problem,

Hassan Ghaziri AUB, OSB Beirut, Lebanon Key words Competitive self-organizing maps, Meta-heuristics, Vehicle routing problem, COMPETITIVE PROBABIISTIC SEF-ORGANIZING MAPS FOR ROUTING PROBEMS Haan Ghaziri AUB, OSB Beirut, ebanon ghaziri@aub.edu.lb Abtract In thi paper, we have applied the concept of the elf-organizing map (SOM)

More information

CENTER-POINT MODEL OF DEFORMABLE SURFACE

CENTER-POINT MODEL OF DEFORMABLE SURFACE CENTER-POINT MODEL OF DEFORMABLE SURFACE Piotr M. Szczypinki Iintitute of Electronic, Technical Univerity of Lodz, Poland Abtract: Key word: Center-point model of deformable urface for egmentation of 3D

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

Fall 2010 EE457 Instructor: Gandhi Puvvada Date: 10/1/2010, Friday in SGM123 Name:

Fall 2010 EE457 Instructor: Gandhi Puvvada Date: 10/1/2010, Friday in SGM123 Name: Fall 2010 EE457 Intructor: Gandhi Puvvada Quiz (~ 10%) Date: 10/1/2010, Friday in SGM123 Name: Calculator and Cadence Verilog guide are allowed; Cloed-book, Cloed-note, Time: 12:00-2:15PM Total point:

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

TAM 212 Worksheet 3. Solutions

TAM 212 Worksheet 3. Solutions Name: Group member: TAM 212 Workheet 3 Solution The workheet i concerned with the deign of the loop-the-loop for a roller coater ytem. Old loop deign: The firt generation of loop wa circular, a hown below.

More information

( ) subject to m. e (2) L are 2L+1. = s SEG SEG Las Vegas 2012 Annual Meeting Page 1

( ) subject to m. e (2) L are 2L+1. = s SEG SEG Las Vegas 2012 Annual Meeting Page 1 A new imultaneou ource eparation algorithm uing frequency-divere filtering Ying Ji*, Ed Kragh, and Phil Chritie, Schlumberger Cambridge Reearch Summary We decribe a new imultaneou ource eparation algorithm

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

Fall 2010 EE457 Instructor: Gandhi Puvvada Date: 10/1/2010, Friday in SGM123 Name:

Fall 2010 EE457 Instructor: Gandhi Puvvada Date: 10/1/2010, Friday in SGM123 Name: Fall 2010 EE457 Intructor: Gandhi Puvvada Quiz (~ 10%) Date: 10/1/2010, Friday in SGM123 Name: Calculator and Cadence Verilog guide are allowed; Cloed-book, Cloed-note, Time: 12:00-2:15PM Total point:

More information

Distributed Packet Processing Architecture with Reconfigurable Hardware Accelerators for 100Gbps Forwarding Performance on Virtualized Edge Router

Distributed Packet Processing Architecture with Reconfigurable Hardware Accelerators for 100Gbps Forwarding Performance on Virtualized Edge Router Ditributed Packet Proceing Architecture with Reconfigurable Hardware Accelerator for 100Gbp Forwarding Performance on Virtualized Edge Router Satohi Nihiyama, Hitohi Kaneko, and Ichiro Kudo Abtract To

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

Distance Optimal Formation Control on Graphs with a Tight Convergence Time Guarantee

Distance Optimal Formation Control on Graphs with a Tight Convergence Time Guarantee Ditance Optimal Formation Control on Graph with a Tight Convergence Time Guarantee Jingjin Yu Steven M. LaValle Abtract For the tak of moving a et of inditinguihable agent on a connected graph with unit

More information