-
-
-
-
-
-
There is a sequence of n numbers 1, 2, 3,.., n and a stack which
can keep m numbers at most. Push the n numbers into the stack
following the sequence and pop out randomly. Suppose n is 2 and m is
3, the output sequence may be 1, 2 or 2, 1, so we get 2 different
sequences. Suppose n is 7 and m is 5, please choose the output
sequences of the stack:
1, 2, 3, 4, 5, 6, 7
7, 6, 5, 4, 3, 2, 1
5, 6, 4, 3, 7, 2, 1
5, 6, 4, 3, 7, 2, 1
1, 7, 6, 5, 4, 3, 2
3, 2, 1, 7, 6,5, 4 ...
阅读题目
多选题
经典指数
-
在一个N个整数数组里面,有多个奇数和偶数,设计一个排序算法,令所有的奇数都在左边。
请完成sort的代码实现(C++或Java)
C++:
void sort(int N, int[]a)
{
…
}
Java:
void sort(int[]a)
{
…
}
例如:
当输入a = {8,4,1,6,7,4,9,6,4},
a = {1,7,9,8,4,6,4,6,4}为一种满足条件的排序结果 ...
阅读题目
问答题
经典指数
-
-
-
扫描后移动端查看
相关标签
同类标签
|
微信公众号
|
|
欢迎加入,一起群聊
|