问题 单项选择题

若已知一个栈的入栈序列是1、2、3、…、n,其输出序列是p1、p2、p3、…、pn,则加为( )。

A.i

B.n-i

C.n-i+1

D.不确定

答案

参考答案:C

解析: 栈是一种特殊的线性表,只能在固定的一端进行插入和删除操作。栈的运算是一种后进先出的操作原则。本题中,入栈序列与输出序列的倒置是对应的,即输出序列的P1对应入栈序列的 n,输出序列的p2对应入栈序列的n-1,由此可推出,加pi应入栈序列的n-i+1。

填空题
阅读短文,从方框中选择适当的词并用其正确形式填空,使短文通顺、意思完整。每空限填一词,
每词限用一次。方框中有两个词是多余的。
dirty   with   have   always   time   they   large   want   speak   lesson   first   drop
    After a quick breakfast, I went into the lecture hall in a hurry. A famous teacher was 1.            to the
students. He was holding up a $100 bill. Then he said to the three hundred students, "Who would like this
$100 bill?" The students put up 2.             hands at once. Then he said, "I am going to give this $100 bill
to one of you, but 3.           , let me do this." He made the bill into a ball. Then he said. "Who 4.             
it now?" The hands went back into the air. "Well," he said, "what if I do this?" and he 5.             it on the
floor and stepped on it. He picked up the 6.             bill and said. "Who still wants it?" Hands went back
again into the air. 
     "My friends," he said, "you have learned a valuable (有价值的) 7.             today. No matter what I did
to the $100 bill! Many 8.             in our life,we are dropped and stepped on. We feel as if we are worth
nothing. But remember, no matter what 9.             happened to you, you will never lose your value: You
are 10.             valuable to those people who love you. Your value doesn't come from what you do or
whom you know, but who you are."
单项选择题