问题 单项选择题

二叉树若用顺序方法存储,则下列四种算法中运算时间复杂度最小的是______。

A.先序遍历二叉树
B.判断两个指定位置的结点是否在同一层上
C.层次遍历二叉树
D.根据结点的值查找其存储位置

答案

参考答案:B

解析: 选项A、C、D运算的时间复杂度都是O(n),而选项B的运算的时间复杂度为O(1),因为对于指定位置p和q的两个结点,判断是否在同一层上,只需判断两者

=

是否成立。

名词解释
填空题

World Water Shortage


A new study warns that about thirty percent of the world’s people may not have enough water by the year 2025.
A private American organization called (1) Action International did the new study. It says (2) than three-hundred-thirty-five-million people (3) enough water now. The people live in twenty-eight (4) . Most of the countries are in Africa or the (5) East.
P-A-I researcher Robert Engelman says (6) the year 2025, about three-thousand-million people (7) lack water. At least 18 more countries are (8) to have severe water problems. The demand (9) water keeps increasing. Yet the amount of water on Earth (10) the same.
Mr. Engelman says the population in countries that lack water is (11) faster than in other parts of the world. He says (12) growth in these countries will continue to (13) .
The report says lack of water in the future may (14) in several problems. It may increase health (15) . Lack of water often means drinking (16) not safe. Mr. Engelman says there are problems (17) over the world because of diseases, such as cholera, (18) are carried in water. Lack of water may also result (19) more international conflict. Countries may have to (20) for water in the future. Some countries now get sixty percent of their fresh water from other countries. This is true of Egypt, the Netherlands, Cambodia, Syria, Sudan, and Iraq. And the report says lack of water would affect the ability of developing to improve their economies. This is because new industries often need a large amount of water when they are beginning.