问题
单项选择题
一个栈的入栈序列是1,2,3,…,n,其输出序列为P1,P2,P3,…,Pn,若p1=n,则Pi为( )。
A) i
B) n-i
C) n-i+1
D) 不确定
答案
参考答案:C
解析: 栈是先进后出的线性表。p1=n,即n是最先出栈的,根据栈的运算原理,n必定是最后入栈的,那么输入顺序必定是1,2,3,…, n,则出栈的序列是n,n-1,n-2,…,1,所以答案是C。
一个栈的入栈序列是1,2,3,…,n,其输出序列为P1,P2,P3,…,Pn,若p1=n,则Pi为( )。
A) i
B) n-i
C) n-i+1
D) 不确定
参考答案:C
解析: 栈是先进后出的线性表。p1=n,即n是最先出栈的,根据栈的运算原理,n必定是最后入栈的,那么输入顺序必定是1,2,3,…, n,则出栈的序列是n,n-1,n-2,…,1,所以答案是C。
首先,请阅读以下手机游戏介绍:
小题1:Frank wishes to get a game for his new Apple phone. He loves to play those kinds of games in which his role is a pilot, a brave soldiers or a tough man of other kinds who fight to rescue people in trouble. 小题2:Charlie wants to download a game with different levels of difficulty for his mobile phone. He wants it for free and hopes that it will bring him lots of laughter. Of course, he wishes it would have wonderful visual and sound effect. 小题3:Eddie is a young man with sporting blood. He likes to do things that can bring him challenges and adventures. So when it comes to mobile phones games, he definitely wants to get one adventure games for his phone. 小题4:For Brad Green, no games can attract him more than those related to cars. Now he would love to download a car racing games for his new phone. And of course, he wishes to get one that can help to improve his driving skills at the same time. 小题5:Tony loves to play games with his new cell phone. It seems that nothing can prevent him from playing those games, his father Mr. Greg has got a new idea instead. He wants to find a game that could help with Tony’s knowledge of geography. |