Given a weighted graph below. What is the total edge-weight of the minimum spanning tree of G?
5 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "40". Các cạnh là A–B = 3, A–D = 8, B–C = 4, B–E = 18, C–D = 6, C–E = 12, D–F = 16, E–F = 15. Chạy Kruskal theo trọng số tăng: lấy A–B = 3, lấy B–C = 4, lấy C–D = 6, bỏ A–D = 8 vì đã có đường A–B–C–D nên thành chu trình, lấy C–E = 12 để chạm E, lấy E–F = 15 để chạm F; tới đây đủ 5 cạnh cho 6 đỉnh nên dừng, D–F = 16 và B–E = 18 đều bị loại. Tổng là 3 + 4 + 6 + 12 + 15 = 40. Phương án "41" là tổng 3 + 4 + 6 + 12 + 16, dùng D–F = 16 thay cho E–F = 15. Phương án "43" là tổng 3 + 4 + 8 + 12 + 16, dùng cả A–D = 8 và D–F = 16. Phương án "48" là tổng 3 + 4 + 8 + 18 + 15, chạm E bằng cạnh đắt B–E = 18. Phương án "25" thấp dưới mức khả thi: riêng việc chạm F đã tốn ít nhất 15 và bốn cạnh nhẹ nhất còn lại cộng vào đã quá 25.
Cùng phần 5
Suppose the graph G = (V,E) satisfies the conditions for the existence of an Eulerian cycle. The following is an algorithm for finding Euler cycle from the vertex X using stack:
declare a stack S of characters (a vertex is labeled by a character)
declare an empty array E (which will contain Euler cycle)
push the vertex X to S
while(S is not empty)
{ch = top element of the stack S
if ch is isolated then remove it from the stack and put it to E
else
select the first vertex Y (by alphabet order), which is adjacent
to ch,push Y to S and remove the edge (ch,Y) from the graph
}
the last array E obtained is an Euler cycle of the graph
Suppose a multigraph G is given below (view picture). Which of the followings is the Euler cycle from the vertex B, created by above algorithm?Có lời giảiCâu hỏiGiven the graph G = (V,E) and X is a vertex of G. Suppose there exists at least one Hamilton Cycle for the graph. The following is a backtracking algorithm for finding the first Hamilton cycle from the vertex X:
declare an empty array H (which will contain Hamilton cycle)
(1) Put the vertex X to H
(2) Check if H is a Hamilton cycle then stop, else go to (3)
(3) Consider the last vertex Y in H, if there is/are vertex(es) adjacent to Y, select the first adjacent vertex Z (by alphabet order) and put it to H. If there no adjacent vertex, remove Y from H and denote it as a bad selection (so you do not select it in the same way again).
Go to (2).
Suppose a G is given below (view picture). Which of the followings is the Hamilton cycle from the vertex A, created by above algorithm?Có lời giảiCâu hỏiWhat data structure is used for breadth first traversal of a graph?Có lời giảiCâu hỏiCả 48 câu của chủ đề48 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây