问题 单项选择题

山区某乡的6个村之间有山路如图14-32所示,其中的数字标明了各条山路的长度(公里)。
乡政府决定沿山路架设电话线。为实现村村通电话,电话线总长至少为 (23) 公里。

A.11

B.14

C.18

D.33

答案

参考答案:B

解析:

[分析]: 显然,这是求已知图的最小生成树的问题。含有n个顶点的连通图的生成树有n个顶点和n-1条边。对一个带权的图(网),在一棵生成树中,各条边的权值之和称为这棵生成树的代价。其中代价最小的生成树称为最小代价生成树(简称最小生成树)。
MST性质:设G=(V,E)是一个连通网络,U是顶点集V的一个真子集。若(u,v)是G中所有的一个端点在U(u∈U)里、另一个端点不在U(即v∈V-U)里的边中,具有最小权值的一条边,则一定存在G的一棵最小生成树包括此边(u,v)。
求连通的带权无向图的最小代价生成树的算法有普里姆(Prim)算法和克鲁斯卡尔(Kruskal)算法。
(1)普里姆算法。设已知G=(V,E)是一个带权连通无向图,顶点V={0,1,2,…,n-1}。设U是构造生成树过程中已被考虑在生成树上的顶点的集合。初始时,U只包含一个出发顶点。设丁是构造生成树过程中已被考虑在生成树上的边的集合,初始时丁为空。如果边(i,j)具有最小代价,且i∈U,j∈V-U,那么最小代价生成树应包含边(i,j)。把j加到U中,把(I,j)加到T中。重复上述过程,直到U等于V为止。这时,T即为要求的最小代价生成树的边的集合。普里姆算法的特点是当前形成的集合丁始终是一棵树。因为每次添加的边是使树中的权尽可能小,因此这是一种贪心策略。普里姆算法的时间复杂度为O(n2),与图中边数无关,所以适合于稠密图。
(2)克鲁斯卡尔算法。克鲁斯卡尔算法的特点是当前形成的集合T除最后的结果外,始终是一个森林。克鲁斯卡尔算法的时间复杂度为O(elog2e),与图中顶点数无关,所以较适合于稀疏图。

阅读理解

阅读理解。

     The spider is very little and clever. Its body is made up of two parts. It has four pairs of legs and eight

little eyes.

     The spider loves work. It begins to work as soon as it begins to live. Every spider is a weaver. Even the

youngest spider knows how to weave (编织) its web just as well as the oldest.

     The silk of which it makes its web comes from its body. It is like hairs. Many of these hairs come out

at the same time, but they are all formed into one rope of silk. It is so thin that a hundred of them together

are only as thick as a human hair.

    First the spider fasten (固定) one end of the silk thread (丝线) to a leaf or to a piece of wood, then it turns

and fastens it to the other end.

    When the spider fastens both ends, it can run down the silk and fix some more threads. These are the

cross ropes of the web. Then it weaves other lines round them, and makes about twenty rings.

    Then spider works hard and fast, and it finishes its work in less than an hour. The web is then so strong

that the wind cannot blow it away and the rain cannot break it. The purpose of the spider's web is to catch

insects, which are its food.

     Insects cannot walk or fly out of the web, because the spider covers it all with something like glue (胶水),

which sticks to anything that touches the web and holds it fast (牢固).

     Not all the spiders are the same sort of work to do. Some spiders are masons (泥瓦匠). They build houses

the size of a big thimble (顶针). They make doors in them, which they shut after them when they go in. They

can even fasten the door of the house from the inside, so that no robber can get in.

     The garden spider lets thread float in the air till they stick to plants or to the branches of trees. It then uses

these threads as the roads or bridges to cross from one place to another.

1. What is the spider's silk like?

A. It's very thin. One hundred of them are as thin as a human hair.

B. It's very strong. It is made of human's hair.

C. It's really like human hair and it's as thin as human's hair.

D. It's as strong as one hundred human's hair.

2. While the spider makes its web, _______.

A. first it makes a leaf or a piece of wood

B. first it fixes one end of the silk thread firmly to a leaf or a piece of wood

C. first it fixes one end of the silk thread to its own head

D. first it fixes human's hair to a leaf or a piece of wood. Then makes a web along the air

3. The spider makes about _______ rings.

A. thirsty

B. a hundred

C. fifty

D. twenty

4. The spider finishes its work _______.

A. more than a day

B. in less than an hour

C. in a week

D. in half an hour

5. Which of the following is true?

A. All the spiders are masons.

B. The garden spider lets thread float in the air to catch insects.

C. The silk of which makes its web comes from human's hair.

D. The spider is both little and clever.

选择题