已知下面的树。如果采用深度优先搜索,搜索的顺序是什么? You are given the tree below. If depth-first search is used, what will be the order of the search?单项选择题

题目图片
A

v1, v2, v3, v4, v5, v6, v7, v8

B

v2, v1, v5, v8, v6, v3, v7, v4

C

v1, v2, v3, v5, v6, v8, v4, v7

D

v2, v5, v8, v6, v7, v3, v4, v1

登录即可查看完整答案

我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。

类似问题

Consider an undirected graph G. Suppose we perform a depth-first search (DFS) starting from vertex v. Which of the following is true?

A complete graph is one where every two vertices are connected with an edge. Suppose we run DFS on a complete graph. What would the DFS tree look like?

Question textConsider a directed graph with 6 nodes and the following arcs:2, 4, i.e. arcs are (1,2), (1,4) 3, 5, i.e. arcs are (2,3), (2,5) 2, 6, i.e. arcs are (3,2), (3,6) 2, 3, 6, i.e. arcs are (4,2), (4,3), (4,6) 3, 4, 6, i.e. arcs are (5,3), (5,4), (5,6) 2, 3, 4, i.e. arcs are (6,2), (6,3), (6,4) Perform a depth-first search starting at node 1. When exploring outgoing arcs, consider neighbouring nodes in increasing order of node number. Provide the predecessor nodes found by the search for: Node 4: Answer 1 Question 1[input], Node 5: Answer 2 Question 1[input], Node 6: Answer 3 Question 1[input]. The algorithm appends each node found to a list. It next considers a node from the Answer 4 Question 1[select: , beginning of, end of] the list of active nodes. The longest path from Node 1 to any other node (measured by number of arcs) in the resulting DFS tree has a length of Answer 5 Question 1[input]. The complexity of depth-first search on a network with nodes and arcs is: Answer 6 Question 1[select: , O(n), O(n^2), O(m), O(n m)]

给定下面的算法。You are given the algorithm below.  回答下列问题。Answer the following questions. Q1: 在执行过程中,该算法会将无向图 G(V, E) 的所有节点推入 S。 During the execution, this algorithm will push all the nodes of an undirected graph G(V, E) into S. [選擇] 这句话在任何情况下都是对的。Always true. 这句话在任何情况下都是错的。Always false 这句话只有在图 G(V, E) 是连通图的情况下才是对的。It is true only if the G(V, E) is connected. Q2: 该算法按以下顺序探索图G(V, E) 。 This algorithm explores the graph G(V, E)  in the order of [選擇] 深度优先。depth first. 广度优先。breadth first. 既不是深度优先,也不是广度优先。neither depth first nor breadth first.

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!