leetcode 232:Implement Queue using Stacks
python java c++...
分类:
其他好文 时间:
2015-07-07 07:06:49
阅读次数:
102
这道题一般既可以用一个queue也可以用2个queue来解决 这里使用一个queue来解决 代码如下class Stack: # initialize your data structure here. def __init__(self): self.stack = []...
分类:
其他好文 时间:
2015-07-07 07:04:48
阅读次数:
113
Very similar as "Implement Stack using Queues".class Queue { stack _s0; stack _s1; int _front; public: // Push element x to the back of...
分类:
其他好文 时间:
2015-07-07 07:03:55
阅读次数:
112
linux编译boost的链接:http://blog.csdn.net/majianfei1023/article/details/46761029
昨天编译安装好boost,今天准备使用boost.python写个python调用c++代码的例子,结果踩了很多坑。
首先贴上代码:
1.student.cpp,一个普通的c++类
#include
#include
using...
分类:
编程语言 时间:
2015-07-07 00:57:00
阅读次数:
151
虽然DLX可以提高效率....但是对于NPC问题也不用太追求效率了,而且还只有一个测试点。所以 只要DFS不断的填入,直到空格全部被填满;要注意的是DFS中全局变量的更新和恢复。至于存储的方法,只要考虑每一行每一列每一个小块的不重复即可。#include #include using namespa...
分类:
编程语言 时间:
2015-07-07 00:53:28
阅读次数:
273
win服务:using System.ServiceProcess;继承ServiceBase 即可定时器:private System.Timers.Timer PushOrderTimer;绑定事件Elapsed private void PushOrderTimer_Elapsed(objec...
视图引擎采用Razor写的增删改查Controllersusing System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using MvcApplication...
分类:
Web程序 时间:
2015-07-07 00:50:42
阅读次数:
137
状态压缩,当我们的状态太多时可以考虑用bit来存储,用二进制来表示集合,用&来取交集,用^来异或。DP过程很简单,遍历所有情况取最短路径就行,因为最短哈密顿回路本身就是一个NPC问题,效率不高。#include #include using namespace std;//最短哈密顿回路问题 NP完...
分类:
编程语言 时间:
2015-07-07 00:43:00
阅读次数:
196
#include
#include
#include
using namespace std;
//观察者模式。
//定义了一对多的关系,让多个观察对象同时监听一个主题对象,
//当主题对象发生变化时,多个对象作出相应的响应。
class School
{
public:
School(char *s)
{...
分类:
其他好文 时间:
2015-07-06 23:33:33
阅读次数:
255
结构比较
数组和元组都实现接口IStructuralEquatable和IStructuralComparable.这两个接口不仅可以比较引用,还可以比较内容.这些接口都是显示实现的,所以在使用时需要把数组和元组强制转换为这个接口.IStructuralEquatable接口用于比较两个元组或数组是否有相同的内容,IStructuralComparable接口用于给元组或数组排序.
using...