Pre Order traversal starts from the root and applies DFS, while going left to right
Post Order traversal starts from the left most node and applies DFS, while traversing the right node and then covering concerned root
As traversing in the given order, starting from 'c' then going to a connected node while choosing according to the order
(b) Given the following tree (graph) as shown in Figure 2: Diberi pepohon (graf) seperti yang...
- 9 (d) Use Depth First Search to find a spanning tree for the graph G as shown in Figure 4. (Note: assume the searching start from node f.) Guna Kedalaman Carian Pertama untuk mencari pohon merentang bagi graf G seperti ditunjukkan dalam Rajah 4. (Nota: andaikan carian bermula dari node f.) C Figure 4/ Rajah 4 (20/100) - 9 (d) Use Depth First Search to find a spanning tree for the graph G as shown in Figure 4. (Note:...
Question II - Graph Traversal and Minimum Spanning Trees [40 Points] Consider the following graph: B 10 1 4 1 H 9 4 a) Traverse the graph starting from vertex A, and using the Breadth-First Search algorithm. Show the traversal result and the data structure you are using. [10 Points] b) Traverse the graph starting from vertex A, and using the Depth-First Search (Post-order) algorithm. Show the traversal result and the data structure you are using. [10 Points] c) Apply...
SULIT (EKT 318) (d) An electrical circuit is shown in Figure 1.2. Litar elektrik ditunjukkan seperti dalam Rajah 1.2) i) Determine transfer function G(s)-I(s)/E(s) of the electrical system. Tentukan fungsi rangkap pindah G (s) I(s)/E(s) sistem elektrik ini.) 6 Marks Markah] ii) Evaluate the effect of a step input on the output of the system. Nilaikan kesan masukan unit langkah kepada keluaran sistem ini. 2 Marks /Markah (Assume, L = 50H, R= 10 Ohm, C = 0.001 Farad and 0...
Figure 4/ Rajah 4 (20/100) (e) Consider the machine Moore M shown in Figure 5. The state So is the starting state and state S2 is the terminal state. The input set is I {a, b}. Pertimbangkan mesin Moore M ditunjukkan dalam Rajah 5. Keadaan So adalah keadaan mula dan keadaan S2 adalah keadaan terminal. Set input adalah | = (a, b) 8-8-8 So Figure 5: Machine Moore M/ Rajah 5: Mesin Moore M (i) What is L(M)? Apakah L(M)?...
2. Write a recursive algorithm which computes the number of nodes in a general tree. 3. Show a tree achieving the worst-case running time for algorithm depth. 4. Let T be a tree whose nodes store strings. Give an efficient algorithm that computes and prints, for every node v of T, the string stored at v and the height of the subtree rooted at v. Hin Consider 'decorating' the tree, and add a height field to each node (initialized to...
discrete 2 question 31 For Esercises 25.28, write the nodes in a breadth first search of the graph for Exercises 21 the node specified 25、 26, g 20. In the computer network in the accompanying figure, the same message is to be broade Dribe ( 21-24 28. e 27. to nodes 4.Е. F and G. One way to do this is to find the shortest path from C to send out multiple copies of the same message. A more etficient...
4. Consider the following graph: 2 . Starting from node B, please copy the above picture as many times as needed and, for each approach to building a spanning tree below, (a) draw the tree and (b) Show (by writing a number next to each node) the order in which nodes are added to the tree during its construction: a. Dijkstra's spanning tree (2 points) b. Prim's spanning tree (2 points) c. Depth-first tree (2 points) d. Breadth-first tree (2...
A motor is given in Figure 1 with the terminal voltage of the motor is 320 V, armature resistance of 2 2, series field resistance of 3 2, and KC value of 0.248. Sebuah motor diberi dalam Rajah 1 dengun voltan pangkalan pada motor sebanyak 320 V, rintangan angker adalah 2 S rintangan madan sesiri adalah 3 Q, dan nilai KC sebanyak 0.248. Figure 1 Rajah I a) Calculate the speed of the motor in Figure 1 when the armature...
2. This question concerns the graph G shown below. (a) Mark the spanning tree for G obtained by performing a depth-first search starting at the vertex E, and using the convention that nearby vertices should be explored in a counter-clockwise fasion, beginning with east; so E comes first, then NE, then N, ... (b) Mark the spanning tree for G obtained by performing a breadth-first search starting at the vertex E, and using the convention that nearby vertices should be...
b) Given the following graph: AC ACE CEG C- ACE Is this graph has an Euler cycle? Justify your answer. 12 marks] i) Use the breadth first search algorithm to find a spanning tree in the above h. Assume vertex A is the root and the vertices are ordered Show clearly each step of how the algorithm is performed and present your answer in a table with three columns, the first column is the number of steps, the second column...