double getUnixTime(void){ struct timespec tv; if(clock_gettime(CLOCK_REALTIME, &tv) != 0) return 0; return (((double) tv.tv_sec) + (double) (...
分类:
系统相关 时间:
2014-07-30 23:25:05
阅读次数:
228
//code:#include#includeusing namespace std;typedef int status;typedef int elemType;typedef struct lNode{elemType num;struct lNode *next;}lNode,*linkNo...
分类:
其他好文 时间:
2014-07-30 23:13:45
阅读次数:
189
直接递归
代码:
#include
#include
using namespace std;
typedef struct listNode{
int key;
struct listNode *pNext;
} * pNode,Node;
void createNode(pNode &pHead){
bool isFirst=true;
int temp;
sc...
分类:
其他好文 时间:
2014-07-30 20:57:14
阅读次数:
174
//代码为自己编写,可能有问题,欢迎大家留言指正!
#include
#include
using namespace std;
typedef struct dnode
{
int val;
dnode *prior;
dnode *next;
}dnode;
dnode * create();
void traverse(dnode *pHead);
bool insert(dn...
分类:
其他好文 时间:
2014-07-30 20:56:44
阅读次数:
210
#define T Stack_T
typedef struct T *T;
struct T {
int count;
struct elem {
void *x;
struct elem *link;
} *head;
}
const T stk //指针常量, const修饰struct T *。地址不能变。
const struct T *stk //指向常量的指...
分类:
其他好文 时间:
2014-07-30 20:56:14
阅读次数:
187
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define PR 1e-8
#define N 510
struct TPoint{
double x, y, z;
TPoint(){}
...
分类:
其他好文 时间:
2014-07-30 20:55:34
阅读次数:
241
#include
#include
#include
using namespace std;
struct node{
int x , y ;
} p[2600];
int q[1200] ;
bool cmp(node a,node b)
{
return a.y < b.y || ( a.y == b.y && a.x < b.x ) ;
}
int main()
{...
分类:
其他好文 时间:
2014-07-30 17:44:44
阅读次数:
219
#include
#include
using namespace std;
typedef struct node
{
int val;
node *next;
}node;
node * create_list();
void traverse_list(node *pHead);
int get_len_list(node *pHead);
bool delete_list(no...
分类:
其他好文 时间:
2014-07-30 17:43:54
阅读次数:
237
顺序表指的是数据元素在内存中连续分配地址的数组,由于指针无法指出数组长度,编译时不会报错,所有用结构体来表示一个顺序表:
顺序表用C语言的表示方法如下:
#define MaxSize 100 #define OK 1
#define ERROR -1
typedef int elem_type;
typedef int Statue;
// int Arrylength...
分类:
其他好文 时间:
2014-07-30 17:36:44
阅读次数:
256
使用数据结构stack或者递归
1 使用stack
#include
#include
using namespace std;
typedef struct listNode{
int key;
struct listNode *pNext;
} * pNode,Node;
void createNode(pNode &pHead){
bool isFirst=true;...
分类:
其他好文 时间:
2014-07-30 17:30:34
阅读次数:
189