二叉树定义:每个结点最多有两个子树的树struct TreeNode { int val;
TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL),
right(NULL) {} };...
分类:
其他好文 时间:
2014-05-26 23:43:52
阅读次数:
351
添加重要的命名空间:using
System.Runtime.InteropServices;先建立结构相同(char长度相同)的Struct类型用于转换:[StructLayout(LayoutKind.Sequential,
Pack = 1)] public struct Employe...
分类:
其他好文 时间:
2014-05-26 23:25:14
阅读次数:
302
已经无法再精简,适合入门。 1 #include 2 #include 3 4
#include 5 #include 6 #include 7 #include 8 struct mengc_dev{ 9 char data[64];10
struct cdev...
分类:
系统相关 时间:
2014-05-26 22:52:42
阅读次数:
371
枚举其实很重要,特别是在应用开发初期,服务器端数据格式需要更改得情况下,枚举和宏都能是程序简洁,并且改动小。网上有个人写的言简意赅,适合初学转自:http://blog.csdn.net/ysy441088327/article/details/8012677题记:
蛋疼的枚举, 千万别小视了! 进...
分类:
移动开发 时间:
2014-05-26 22:47:49
阅读次数:
257
/*代码一:DFS+Enum*///Memory Time //240K 344MS
//本题只要求输出翻转的次数,因此BFS或DFS都适用#includeusing namespace std;bool
chess[6][6]={false};//利用的只有中心的4x4bool flag;in.....
分类:
其他好文 时间:
2014-05-26 22:45:54
阅读次数:
323
【7.4】 1 #include 2 #include 3 #include 4 using
namespace std; 5 #define MAXN 100 6 7 typedef struct node{ 8 char data; 9 node
*lchild;10 ...
分类:
其他好文 时间:
2014-05-23 03:26:20
阅读次数:
260
克鲁斯卡尔
struct edge
{
int u, v, w;
}e[maxn];
int f[110];
bool cmp(edge a, edge b)
{
return a.w < b.w;
}
int find(int x)
{
if(x != f[x])
return f[x] = find(f[x]);
return f[x];
}
int MST()
{
int...
分类:
其他好文 时间:
2014-05-23 02:15:51
阅读次数:
267
题目说:Try to do this in one pass
只用一遍遍历的话,p1先走n节点,p2再走,等到p1到达链表尾的时候p2正好在倒数第n+1个上面鸟
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode...
分类:
其他好文 时间:
2014-05-23 01:52:29
阅读次数:
331
结构是使用 struct 关键字定义的,与类相似,都表示可以包含数据成员和函数成员的数据结构。 一般情况下,我们很少使用结构,而且很多人也并不建议使用结构,但作为.NET Framework 一般型別系统中的一个基本架构,还是有必要了解一下的。
结构的特征: 结构是一种值类型,并且不需要堆分配。 结构的实例化可以不使用 new 运算符。
在结构声明中,除非字段被声明为 const 或 stat...
分类:
其他好文 时间:
2014-05-23 01:05:52
阅读次数:
298
题意:给你个矩阵,里面有n个标记的点,许多只青蛙在上面跳,每次跳的距离都是一样的且轨迹是直线,目标是从一边跳到另一边,求最多步数的青蛙
思路:排序后,枚举判断
#include
#include
#include
#include
using namespace std;
const int MAXN = 5050;
struct point{
int x,y;
void ini...
分类:
其他好文 时间:
2014-05-22 18:50:02
阅读次数:
255