问题 填空题

阅读以下说明和C函数,将应填入______处的语句或语句成分写在对应栏内。
[说明]
已知单链表L含有头节点,且节点中的元素值以递增的方式排列。下面的函数DeleteList在L中查找所有值大于minK且小于maxK的元素,若找到,则逐个删除,同时释放被删节点的空间。若链表中不存在满足条件的元素,则返回-1,否则返回0。
例如,某单链表如图1所示。若令minK为20,maxK为50,则删除后的链表如图2所示。



链表节点类型定义如下:
typedef Struct Node
int data;
struct Node*next;
Node,*LinkList;
[C函数]
int DeleteList(LinkListL,int minx,int maxK)
/*在含头节点的单链表L中删除大于minx且小于maxK的元素*/
______*q=L,*p=L->next;/*p指向第一个元素节点*/
int deiTag=0;
while(p)
if(p->data<=minK)
iq=p;p=______;
else
if(p->data<maxK=/*找到删除满足条件的节点*/
q->next=______free(p);
p=______;delTag=1;

else break;
if(______)return-1;
return 0;

答案

参考答案:q->next

阅读理解

A man went into a restaurant and sat down at one of the tables.

A waiter went up to him and gave him the menu.

The man read it carefully, then ordered(点餐) all the most expensive foods and began to enjoy himself.

Then a small boy came into the restaurant and sat at the man’s table.

The waiter came up and said to the man, “What would your little boy like, sir?”

“Oh, just an ice cream, ” the man told him. Then he said to the waiter, “I’m just going out to buy a newspaper.”

He left the restaurant. The waiter gave the boy an ice cream. The boy ate it, and then stood up and walked to the door.

The waiter ran to him.

“Excuse me,” he said, “but your father hasn’t come back and he hasn’t paid for his meal or for your ice cream.”

“I’m sorry,” The young boy said, “He’s not my father, I don’t know who he is.”

The waiter did not understand. “What do you mean?” he asked.

“The man came up to me in the street, ” the boy said. “He asked me if I liked ice cream. I told him I did. Then he told me to come into the restaurant at 2:00pm and sit down at his table. He said he’d give me some.”

After knowing the truth, the waiter felt so sad, because he had to pay money for the meal.

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

小题1:What did the man order in the restaurant?

                                    

小题2:Where did the little boy sit?

                                    

小题3:Was the small boy the man’s son?

                                  

小题4:When did the man tell the boy to come into the restaurant?

                                 

小题5:Who paid money for the meal?

                               

选择题