问题 填空题

对于关键码序列18,30,35,10,46,38,5,40进行堆排序(假定堆的根节点为最小关键码),在初始建堆过程中需进行的关键码交换次数为______。

答案

参考答案:C

解析: 堆排序是完全二叉树的一个重要应用,可以解释为完全二叉树中的任一节点的关键码都小于或等于它的两个子女的关键码。排序的基本思想是:对一组待排序的关键码首先把他们按照堆的定义排成一个序列(建堆),取出最小关键码,余下的关键码再建堆,再取出最小关键码,如此反复,直到全部关键码排序完毕。本题的解答步骤,第一次:18,30,5,10,46,38,35,40。第二次:18,10,5,30,46,38,35,40。第三次:5,10,18,30,46,38,35,40。3次以后就可以了。

阅读理解

阅读理解。

     Jenny was a very kind and beautiful woman and before she got married, many men werc in love with

her. Many of them wrote to her, telling her how wonderful she was, how much they lovcd her and wanted

to marry her.

     Jenny kept all these letters. She tied them up with a red ribbon (丝带) and put them away in an old

box. She never looked at them as she was happily married,  however. they werc a part of her life and

she did not want to throw them away.

     Jenny had a daughter. Sue was six. One day, Jenny had to leave Sue alone for half an hour. "Now be

a good girl," she said.  "Play quietly.  If you need anything, go to the lady next door."

    When she returned home, she asked Sue, "Have you been a good girl?"

     "Oh, yes, Mommy," Sue said.

     "What did you do while I was out?" Jenny asked her.

     "I played mailman," Sue told her.

     "How could you play mailman, darling?" Jenny asked. You didn't have any letters."

     "Oh, yes, I did, Mommy," Sue said. "I found some in an old box upstairs. They wer tied up with a

red ribbon. I put one in cvcry mailbox on the street. Wasn't I a good girl?"

根据短文内容,回答下列问题。

1. Where did Jenny put her letters?

    _____________________________

2. Why did Jenny neverlook at the letters?

    _____________________________

3. How old was Jenny" daughter?

    _____________________________

4. Did Sue go to he lady next door to ask for help?

    _____________________________

5. What did Sue do while her mother was out?  

    _____________________________

选择题