二分图解决这个问题的思路#include #include #include #include #include #include using namespace std;class Node{public:string name;vector adj;bool visited;int groupI...
分类:
其他好文 时间:
2014-10-08 01:24:14
阅读次数:
298
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
/**
* http...
分类:
其他好文 时间:
2014-10-08 01:05:04
阅读次数:
253
使用双向链表+map,实现O(1)时间内的get和set
需要注意的是:
1. set时更新tail
size为0时更新头部
size为capacity时删除头部并且更新头部
2. get时更新节点到tail的位置,同时如果是节点是头部的话要更新头部
附上代码:
class LRUCache{
struct Node{
int key;
int...
分类:
其他好文 时间:
2014-10-08 01:04:54
阅读次数:
274
CIPAddressCtrl m_ipCtrl;1、获取控件IP值int GetAddress(byte& byteFirst, byte& byteTwo, byte& byteThree, byte& byteFour);int GetAddress(DWORD& dwAddress);byte...
分类:
其他好文 时间:
2014-10-08 00:52:44
阅读次数:
275
头文件:
#include
using namespace std;
template
class hash_set
{
private:
hash_type array[100000];
int hash_fun(hash_type original);
public:
hash_set();//构造函数
void insert(hash_type value);//插入一个元素
v...
分类:
编程语言 时间:
2014-10-08 00:36:14
阅读次数:
349
思路很简单,代码注释已标注
#include
//递归二分查找
int binarySearch(int*start,int *end,intfindData){
if (start > end) { // 递归边界条件
return -1;
}...
分类:
其他好文 时间:
2014-10-08 00:31:55
阅读次数:
288
#include #include using namespace std;class Expr_node{ //friend ostream& operatoruse==0)delete p; }};class Int_node: public Expr_node{ friend cl...
分类:
编程语言 时间:
2014-10-08 00:23:24
阅读次数:
216
最简单的排序算法——冒泡排序: 1 void bubble_sort(int *arr, int len) 2 { 3 int up, down; 4 for(up = 0; up != len; ++ up) 5 { 6 for(down = 0; down != ...
分类:
其他好文 时间:
2014-10-07 23:58:24
阅读次数:
339
在多态的学习中,当子类继承父类时,子类中的变量哪些具备多态特性,哪些不具备多特特性。代码:class Father{ public static int x=10; public int y=11; public Father(){ System.out.printl...
分类:
编程语言 时间:
2014-10-07 23:45:54
阅读次数:
286
LA 6560 - The Urge to Merge
题目链接
思路:状压dp,1表示要和下一个位置竖直乘,0表示不,这样递推下去即可
代码:
#include
#include
#include
using namespace std;
const int N = 1005;
const int INF = 0x3f3f3f3f;
int g[N][3], d...
分类:
其他好文 时间:
2014-10-07 23:44:04
阅读次数:
348