题目链接区间合并,贪心,需要注意边界情况,LeetCode的数据还是比较好的,这样才能写出健壮的程序。附上代码:
1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 *
in...
分类:
其他好文 时间:
2014-05-06 00:16:44
阅读次数:
400
Create linux tar gz (Gzip)archive (创建压缩文件)tar -czvf
myarchive.tgz mydirectory/We use the -t option to create an linux tar archivec–
Creates a new .ta....
分类:
其他好文 时间:
2014-05-05 23:41:27
阅读次数:
403
输入子系统在内核中的位置:/driver/input
drivers/input/input.c: input_init ---> err = register_chrdev(INPUT_MAJOR,
"input", &input_fops); static const struct file_o...
分类:
其他好文 时间:
2014-05-05 23:34:42
阅读次数:
516
编程语言更迭至今,几乎没有人没有用过一门不用垃圾回收的语言,一方面因为C之类的语言内存管理较为困难,更重要的是因为语言越高级,越注重实际的业务逻辑,而关于内存管理的代码频繁夹杂在业务中,并不那么自然。###
没有垃圾回收的编程体验 #include #include struct node { .....
分类:
其他好文 时间:
2014-05-05 21:49:59
阅读次数:
329
??
#include
#include
typedef struct emp{
char sex[8];
char name[15];
int age;
}*emp;//这里我们用typedef把emp这个结构体变成了*emp这种指向结构体成员的结构体指针
/*typedef struct emp{
char sex[8];
char name[15];
int...
分类:
编程语言 时间:
2014-05-05 12:54:29
阅读次数:
277
// BTree.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"stdlib.h"
#include"malloc.h"
#define BT BTreeNode
#define MS 10
typedef struct BT{
char data;
struct BT *left;
struct BT *right;
}BT;
...
分类:
其他好文 时间:
2014-05-04 12:45:34
阅读次数:
365
1,指针没有指向一块合法的区域1指针没有初始化12345678910111213#include #include struct aa{char
*pa;char c;}ssa,*ssb;void main(){strcpy(ssa.pa,"abc");printf("%s \n",ssa.pa);...
分类:
其他好文 时间:
2014-05-04 11:38:09
阅读次数:
278
tmux中默认的shell是zsh,zsh在日常中使用可以协助我们高效地使用shell命令。#
设置Shellset-option -g default-shell /bin/zsh# 设置复制模式,空格开始选,Enter结束复制setw -g
mode-keys vi #开启status-bar ...
分类:
系统相关 时间:
2014-05-03 22:06:18
阅读次数:
1323
//非递归遍历一棵树 需要借助栈
#include
#include
struct Tree
{
int nValue;
Tree *pLeft;
Tree *pRight;
};
struct Stack
{
Tree *root;
Stack *pNext;
};
Stack *pStack = NULL;
void push(Tree *root)
{
St...
分类:
其他好文 时间:
2014-05-03 20:55:41
阅读次数:
325
#include
#include
#include
#include
#include
using namespace std;
#define N 20020
struct node{
int from, to, dou, nex;
}edge[N];
int head[N], edgenum;
void add(int u, int v,int dou){
node E={u,v,dou...
分类:
其他好文 时间:
2014-05-03 15:25:32
阅读次数:
340