Question: Just write it by your hand. you must write it by your hand.do not type it. write it exactly what is wrote in the pictures.do
Just write it by your hand. you must write it by your hand.do not type it. write it exactly what is wrote in the pictures.do it clearly and properly.if you can not read properly then zoom it out... Note: you only do this work if your hand writting is good enough and clear. dont need to be scanned. just upload your hand written work picture. these are part of same problem, write all by your hand .i will up vote you if you do this properly. Thanks
Work: just write down from below




1 Problem 1 Here is a graph where order of verticles are Same for BFs and DFS van BES . (B $ Orders of vertices: A Scanned with CamScanner DFS (A B Ondero of verteices: A Both BFs and DFs order off vertices are same here, Scanned with CamScanner for different oroden BES 17 A B vaders of verotides: A DFS B D Order of verticles: A B 0 So, orders of verticles are not same in this graph. Scanned with CamScanner Prooblem 2 at DFS 3/10 E 415 2111 B (A 0619 78 Oradero of vertices: A E @@OD 415 E (A 1/12 B 211 CA 3/10 1619 7/8 361 BES pament > (-00 level (o WGB A W3 WAR soe wy WOR FOOA B} (DI 3 wat in 002 Scanned with CamScanner Queule > AR C DEF Tree, 3. 1 = A Al IB 3 A Order of vertices; (D) (E (F 39 in bolerkojot fiolet Scanned with CamScanner . (Prooblem-3x olimo ?T?! A fuel system is a combination of tank, pump, filter and injectors. Through pipes, , each of the components are connected to each othen: Here, the flow is directed but not neversible. Now, the conditions ane - Each edge in the , graph is a pipe. All te of the edges are directed. Nodes can both generate or use fuel. The time complexity has to be O(num). To solve this problem we can use DFs. Since this is a sec (strongly.connected component) graph a possible fuel system can be Filter Fuel tank Fuel pump Injection) Filter) 2 Scanned with CamScanner Lets assume that on to bruo's wat od res Fuel tank = Arvot britan () Fuel pump = B:.. bisang ost Filteric Injector=E Filter 2-D > We have to use DFs to trace the flow for the best robustness and accuracy. The graph will be, IE A B = For DFs, [0]A queue B [1] A,B queue CD [2]> A,B,C queue DE [3] A, B, C, D queue E [4] A,B,C,D,E queue [ Scanned with CamScanner Here, we found the time complexity is Ocnum) as the traversing depends on both the vertices and edges qui o (; Prooblom-4 Letis assume that; soloTo We have n=2 power plante T 901 In power plant na buildings ) (2) 3 buildings = 8 buildings -> 13 = 1 buildings 1 (Plant 1 oport 2 og god 12:1:2u M (Build Build 2 Build 3 Build 4 Build 8 Plant 2 Build), 5 Build Build 7 E bine! biash Let's assume that emepgeney, generator has I been installed in P2 Power plant. In such case, we can use DFs algorithin to ensure that most of the buildings are powered up. Scanned with CamScanner In DFs, The abogonithon takes the input of graph and an initial vertex to start traverosing For every vertex, DF's chooses the deepest edge to traverse through. Since every buil- ding is connected either bi-directionally or recursively : So every building will be powered up. No building cuill be burned out since not a single building is connected to two powerplants at the same time. Now tracing: DFS : [0]Plant 1 stack Build 1, Build2 [1] Plant1 , Build 1, Build 2 ] Stack Build 3, Build 4, Build 8 [2] => Plant 1, Build1, Build 2, Build 3, [ , Build 4, Build 8 Stck -Builds, Build 6 Build 7 [3] Plant 1, Build 1, Build ?, Build 3, Build 4 , Build 5) Build 6, Build 7, Build 8 noir tu . Scanned with CamScanner The time p complexity is o (m3) npower plants connected, so it will be to versed from each of the power plants every single time. ,',Time complexity --> Onderji Ol(13) 10) 00025) load Problem: 5:1 letos @ Motoros 718 tonigalega 116 19/10 5 4/5 9 12/3 11/12 topological onder: b If we remove the node that has zero in degree and out degree which will in turn pemove an in-degree from the connect nodes and repeat this step until there are no nodes. we will be able to count all the distinct topologic al orders. Scanned with CamScanner 1 if we be more 1 here then we can have two option [ 053 and 035] if we remove o here then we can have 31 = 6 options, " the number of distinct topological ordering of G is (2+6)=8 1 Problem 1 Here is a graph where order of verticles are Same for BFs and DFS van BES . (B $ Orders of vertices: A Scanned with CamScanner DFS (A B Ondero of verteices: A Both BFs and DFs order off vertices are same here, Scanned with CamScanner for different oroden BES 17 A B vaders of verotides: A DFS B D Order of verticles: A B 0 So, orders of verticles are not same in this graph. Scanned with CamScanner Prooblem 2 at DFS 3/10 E 415 2111 B (A 0619 78 Oradero of vertices: A E @@OD 415 E (A 1/12 B 211 CA 3/10 1619 7/8 361 BES pament > (-00 level (o WGB A W3 WAR soe wy WOR FOOA B} (DI 3 wat in 002 Scanned with CamScanner Queule > AR C DEF Tree, 3. 1 = A Al IB 3 A Order of vertices; (D) (E (F 39 in bolerkojot fiolet Scanned with CamScanner . (Prooblem-3x olimo ?T?! A fuel system is a combination of tank, pump, filter and injectors. Through pipes, , each of the components are connected to each othen: Here, the flow is directed but not neversible. Now, the conditions ane - Each edge in the , graph is a pipe. All te of the edges are directed. Nodes can both generate or use fuel. The time complexity has to be O(num). To solve this problem we can use DFs. Since this is a sec (strongly.connected component) graph a possible fuel system can be Filter Fuel tank Fuel pump Injection) Filter) 2 Scanned with CamScanner Lets assume that on to bruo's wat od res Fuel tank = Arvot britan () Fuel pump = B:.. bisang ost Filteric Injector=E Filter 2-D > We have to use DFs to trace the flow for the best robustness and accuracy. The graph will be, IE A B = For DFs, [0]A queue B [1] A,B queue CD [2]> A,B,C queue DE [3] A, B, C, D queue E [4] A,B,C,D,E queue [ Scanned with CamScanner Here, we found the time complexity is Ocnum) as the traversing depends on both the vertices and edges qui o (; Prooblom-4 Letis assume that; soloTo We have n=2 power plante T 901 In power plant na buildings ) (2) 3 buildings = 8 buildings -> 13 = 1 buildings 1 (Plant 1 oport 2 og god 12:1:2u M (Build Build 2 Build 3 Build 4 Build 8 Plant 2 Build), 5 Build Build 7 E bine! biash Let's assume that emepgeney, generator has I been installed in P2 Power plant. In such case, we can use DFs algorithin to ensure that most of the buildings are powered up. Scanned with CamScanner In DFs, The abogonithon takes the input of graph and an initial vertex to start traverosing For every vertex, DF's chooses the deepest edge to traverse through. Since every buil- ding is connected either bi-directionally or recursively : So every building will be powered up. No building cuill be burned out since not a single building is connected to two powerplants at the same time. Now tracing: DFS : [0]Plant 1 stack Build 1, Build2 [1] Plant1 , Build 1, Build 2 ] Stack Build 3, Build 4, Build 8 [2] => Plant 1, Build1, Build 2, Build 3, [ , Build 4, Build 8 Stck -Builds, Build 6 Build 7 [3] Plant 1, Build 1, Build ?, Build 3, Build 4 , Build 5) Build 6, Build 7, Build 8 noir tu . Scanned with CamScanner The time p complexity is o (m3) npower plants connected, so it will be to versed from each of the power plants every single time. ,',Time complexity --> Onderji Ol(13) 10) 00025) load Problem: 5:1 letos @ Motoros 718 tonigalega 116 19/10 5 4/5 9 12/3 11/12 topological onder: b If we remove the node that has zero in degree and out degree which will in turn pemove an in-degree from the connect nodes and repeat this step until there are no nodes. we will be able to count all the distinct topologic al orders. Scanned with CamScanner 1 if we be more 1 here then we can have two option [ 053 and 035] if we remove o here then we can have 31 = 6 options, " the number of distinct topological ordering of G is (2+6)=8