Sort a linked list using insertion sort./** *
Definition for singly-linked list. * struct ListNode { * int val; * ListNode
*next; * ListNo...
分类:
其他好文 时间:
2014-06-06 10:39:38
阅读次数:
212
测试 代码运行时间linux 中的 中 有个函数可以获取当前时间,精确到 微秒
----> gettimeofday() 1 #include // int gettimeofday(struct timeval *tv,
struct timezone *tz); 2 /***...
分类:
系统相关 时间:
2014-06-06 09:10:48
阅读次数:
248
#include#includetypedef struct Node{ int
data; struct Node *next;}LinkList;//就地反转int LinkListRerverse(LinkList
*head){ LinkList *q,*p; p = head->next;...
分类:
其他好文 时间:
2014-06-06 07:35:54
阅读次数:
283
示例代码注重这里p1的作用以下代码是用尾插法添加结点#include #include #define
N sizeof (STU)typedef struct stu{ int num; char name[20];} STU, * PSTU;PSTU
creat (PSTU head) ...
分类:
其他好文 时间:
2014-06-05 19:49:50
阅读次数:
351
三元组表的C++语言描述基本运算的算法——建立稀疏矩阵的三元组表的算法、按矩阵的列序转置算法、按矩阵的行序转置算法#includeusing namespace
std;template class sanyuanzu{ private: struct Node {...
分类:
其他好文 时间:
2014-06-05 18:29:41
阅读次数:
318
十字链表的语言描述基本运算的算法——建立稀疏矩阵的十字链表的算法、输出稀疏矩阵十字链表的算法#includeusing namespace
std;template class shizi{private: struct Node { int i; int j...
分类:
其他好文 时间:
2014-06-05 18:25:08
阅读次数:
272
题意:给定N中货币 两种货币之间可以兑换 并且收取一定的费用 问 给定你一种货币与数量
是否能兑换到原来的货币 使自己的货币增加思路:用bellman算法 判断是否有回路不断的增大;#include#includeusing namespace
std;struct Node{ int u,v; d...
分类:
其他好文 时间:
2014-06-05 18:18:16
阅读次数:
178
题意:一个图中有两种路径 1 无方向权值为政 2 有方向权值为负
问是否存在一个回路其权值为负思路:bellman算法#includeusing namespace std;struct Edge{ int u,v; int
w;}e[15000];int all;int dist[15...
分类:
其他好文 时间:
2014-06-05 17:26:32
阅读次数:
186
Given a binary tree struct TreeLinkNode {
TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next
pointe...
分类:
其他好文 时间:
2014-06-05 13:42:24
阅读次数:
264
#include#include#define MAXSIZE 20typedef char
TEelemtype;typedef struct BiTNode{TEelemtype data;struct BiTNode
*lchild,*rchild;}BiTNode,*BiTree;//队列....
分类:
其他好文 时间:
2014-06-05 13:25:12
阅读次数:
377