试题与答案

对于长度为n的顺序存储的线性表,当随机插入和删除—个元素时,需平均移动元素的个数为

题型:填空题

题目:

对于长度为n的顺序存储的线性表,当随机插入和删除—个元素时,需平均移动元素的个数为

答案:

参考答案:n/2

解析:[评析] 删除—个元素,平均移动的元素个数为(n-l+n-2+…+0)/n=(n-1)/2;插入—个元素,平均移动元素个数为(n+n-1+n-2+…+1)/n=(n+1)/2;所以总体平均移动元素个数为n/2。

试题推荐
题型:填空题

根据句意,从方框中选择恰当的词填空。

the only child, more, How far, at the concert, turn,

most of the time, warmer, stronger, away from, on

1. It's over there, ____ your left.

2. In spring, the weather gets ____ and the trees ____ green.

3. Jack doesn't have any brothers or sisters, so he's ____ in his family.

4. The sign means we should stay ____ the building

5. - ____ is the History Museum from here?

    - It's about a kilometer away.

6. Nancy is going to play the piano ____.

7. Do ____ exercise, and you'll get ____. 

8. It's warm __     in New York.

查看答案
微信公众账号搜索答案