两种操作都是递归实现,汉诺塔思想。
1、逆序栈
void ReverseStack(Stack& stack)
{
if (stack.Count == 0)
return;
object top = stack.Pop();
ReverseStack(stack);
if (stack.Count == 0)
{
sta...
分类:
编程语言 时间:
2015-03-28 08:55:16
阅读次数:
182
c++中的适配器有三种:容器适配器,迭代器适配器,函数适配器。下面一一介绍: 1.容器适配器:因为这些容器都是基于其他标准容器实现的所以叫做容器的适配器,具体的有stack,queue,priority_queue,默认的情况下,stack和queue基于deque而实现的,,priority_qu...
分类:
其他好文 时间:
2015-03-28 01:07:22
阅读次数:
124
数据类型可理解为创建变量的模具(模子);是固定内存大小的别名。
数据类型的作用:编译器预算对象(变量)分配的内存空间大小。
既能读又能写的内存对象,称为变量;若一旦初始化后不能修改的对象则称为常量。
变量本质:(一段连续)内存空间的别名。
内存四区
栈区(stack):也叫临时区,由编译器自动分配释放,存放函数的参数值,局部变量的值等。
堆区(heap):一般由程序员分配释放(...
分类:
其他好文 时间:
2015-03-27 23:58:49
阅读次数:
442
题目链接:trapping-rain-water
import java.util.Stack;
/**
*
Given n non-negative integers representing an elevation map where the width of each bar is 1,
compute how much water it is able to...
分类:
移动开发 时间:
2015-03-27 22:22:39
阅读次数:
158
之前讲过通过storyboard的方式捕获控件的值,现在我们来试试通过纯代码的方式来实现同样的功能。首先定义一个stepper和一个label,用label来显示stepper的当前值。
self.priceStepper = UIStepper(frame: CGRectMake(150, 120, 100, 20))
self.priceStepper.minimumVal...
分类:
编程语言 时间:
2015-03-22 09:17:04
阅读次数:
226
水题,直接贴代码。
//poj 3180
//sep9
#include
#include
using namespace std;
const int maxN=10024;
const int maxM=50048;
int sum[maxN];
int head[maxN],dfn[maxN],low[maxN],ins[maxN],belong[maxN];
stack s;
st...
分类:
其他好文 时间:
2015-03-22 09:14:36
阅读次数:
102
#include#include#include//定义节点struct Node{ int data; struct Node *next;};typedef Node StackNode;//定义栈 struct Stack{ StackNode *top; StackN...
分类:
编程语言 时间:
2015-03-22 00:19:50
阅读次数:
169
问题:将 Frame 含 PopupMenu 放置 Form 后,在 Frame 里的 PopupMenu 失效,无法按快捷键。适用:XE7 update 1 for Windows 平台修正方法:请将源码 FMX.Forms.pas复制到自己的工程目录里,再进行修改。找到 TCommonCusto...
分类:
其他好文 时间:
2015-03-21 12:31:12
阅读次数:
140
Use two stacks :class MinStack {private: stack s, minS;public: void push(int x) { if (minS.empty() || x s;public: void push(int x) { ...
分类:
其他好文 时间:
2015-03-21 08:34:04
阅读次数:
124
双连通缩点+求树的直径,图论基础题目。 1 /* 4612 */ 2 #pragma comment(linker, "/STACK:1024000000,1024000000") 3 #include 4 #include 5 #include 6 #include 7 #i...
分类:
其他好文 时间:
2015-03-20 23:26:12
阅读次数:
203