If keys are pushed onto a stack in the order {1, 2, 3, 4, 5}, then it is impossible to obtain the output sequence {3, 4, 1, 2, 5}.
如果按顺序{1,2,3,4,5}将键推到堆栈上,则不可能获得输出序列{3,4、1,2、5}。
T
F
1-3
分数 1
作者 李廷元单位 中国民用航空飞行学院
在n个元素连续进栈以后,它们的出栈顺序和进栈顺序一定正好相反。
T
F
1-4
分数 2
作者 干红华单位 浙江大学
Given that the pushing sequence of a stack is { 1, 2, ⋯, n } and popping sequence is { x1,x2,⋯,xn }. If x2=n, we can obtain n−1 different possible popping sequences.
Recursive programs are generally faster than equivalent non recursive programs. However, non recursive programs are in general much simpler and easier to understand.
递归程序通常比等效的非递归程序更快。然而,非递归程序通常更简单,更容易理解。
T
F
1-7
分数 1
作者 朱晓龙单位 西安邮电大学
链栈和顺序栈相比,比较明显的优点是通常不会出现栈满的情况。
T
F
1-8
分数 1
作者 朱晓龙单位 西安邮电大学
链栈的插入在栈顶,删除在栈底。
T
F
1-9
分数 1
作者 DS课程组单位 浙江大学
所谓“循环队列”是指用单向循环链表或者循环数组表示的队列。
T
F
1-10
分数 1
作者 DS课程组单位 浙江大学
"Circular Queue" is defined to be a queue implemented by a circularly linked list or a circular array.
“循环队列”被定义为由循环链接列表或循环数组实现的队列。
T
F
1-11
分数 1
作者 Martin Ester单位 浙江大学
An algorithm to check for balancing symbols in an expression uses a queue to store the partial expression.
In most restaurants, we follow one principle called "First come, first served". This principle can be implemented by a queue.
在大多数餐馆,我们遵循一个叫做“先到先得”的原则。这个原理可以通过队列来实现。
T
F
2-1
分数 3
作者 DS课程组单位 浙江大学
Let P stands for push and O for pop. When using a stack to calculate the value of the postfix expression 1 2 3 + * 4 –, the stack operation sequence is:
Following is the C-like pseudo code of a function that takes a Queue as an argument.
下面是一个函数的类C伪代码,该函数以Queue作为参数。
void foo(Queue Q)
{
Stack S = CreateStack(); // create an empty stack
while (!IsEmpty(Q))
{
// dequeue an item from Q and push it into S
Push(S, Dequeue(Q));
}
while (!IsEmpty(S))
{
// pop an item from S and enqueue it into Q
Enqueue(Q, Pop(S));
}
DisposeStack(S);
}