Data structure final exam mock questions (corrected)

Multiple choice

2-1
The figure below shows an AOV network, and its possible topologically ordered sequence is:
Insert picture description here
A.ACBDEF
B.ABCEFD
C.ABCDFE
D.ABCEDF

There is no test site for topological sorting, so skip;

2-2
If a directed graph with n vertices and e arcs is stored in an adjacency table, the time complexity of the topological sorting algorithm is:

A.O(n)
B.O(n+e)
C.O(n^​2​)
D.O(n×e)

There is no test site for topological sorting, so skip;

2-3
gives the network G with 7 nodes as shown in the figure below. Using Prim algorithm, starting from node 4, give the minimum spanning tree of the network. Which of the following options gives the correct order for collecting tree nodes?
Insert picture description here
A.4501362
B.4526301
C.4561023
D.4563201

2-4 The
given directed graph is as follows. Which of the following options is not the corresponding topological sequence?
Insert picture description here
A.abedfc
B.aedbfc
C.aedfbc
D.abdfce

There is no test site for topological sorting, so skip;

Fill in the blank

4-1
In a directed graph with n vertices, if any two points can reach each other, at leastn Arc.

4-2
If a graph with n vertices forms a ring, then it hasn A spanning tree.

This is a knowledge point in graph theory,
because every time you delete an edge, you can get a road with n vertices. The road is also a tree (a connected graph with an acyclic tree). Then there are n kinds of deletion methods.
The essence is Break the circle method. Another method of avoiding circles is generally used for construction.

4-3
For a given directed graph as follows, the in-degree and out-degree of each vertex are in order:
3/0 2/2 1/2 1/3 2/1 2/3
Insert picture description here

Fill in the format:, the 入度1/出度1 入度2/出度2 ... 入度6/出度6two adjacent vertex answers are separated by a space, and no extra symbols are allowed.

E.g:0/1 2/3 4/5 6/0 1/2 3/4

Subjective questions

8-2 Write the breadth-first traversal sequence of the graph according to the adjacency list (10 points)

(1) Write the adjacency list of the following figure (the edge node number is from small to large ), (2) Write the breadth-first search sequence and depth-first search sequence starting from vertex 3, separated by spaces between vertices. It is agreed to visit in priority order of small number of nodes. (Answer pictures can be inserted)
Insert picture description here
Answer: (1) Insert picture description here
(2) Breadth first search sequence: 3 1 2 4 6 0 5; Depth first search sequence: 3 1 0 2 4 5 6;

Depth-first search process: starting from 3 to 1, 1 to 0, 0 to 1 repeated, 0 to 2, 2 to 0 repeated, 2 to 3 repeated, 2 to 4, 4 to 1 repeated, 4 to 2 Repeated, 4 to 3 repeated, 4 to 5, 5 to 2 repeated, 5 to 4 repeated, retraced to 4, 4 to 5 repeated, retraced to 2, 2 to 6;
sequence: 3-1 -0-2-4-5-6

Guess you like

Origin blog.csdn.net/Jessieeeeeee/article/details/107386256