2015年9月20日

排序

摘要: #include #include using namespace std;void bubble(int *a, int len) { for(int i = 0; i a[j + 1]) swap(a[j], a[j + 1]);}void select(int *a, int n) {... 阅读全文

posted @ 2015-09-20 14:18 Susake 阅读(153) 评论(0) 推荐(0) 编辑

2015年9月2日

【3次握手4次挥手】-转

摘要: TCP((Transmission Control Protocol)传输控制协议,是一个面向连接的协议。在运用此协议进行数据传输前都会进行连接的建立工作(三次握手);当数据传输完毕,连接的双方都会通知对方要释放此连接(四次挥手)。认识TCP标志位tcp标志位有6种标示:SYN(synchronou... 阅读全文

posted @ 2015-09-02 23:03 Susake 阅读(220) 评论(0) 推荐(0) 编辑

2015年8月25日

【经典进程同步问题】

摘要: 1.生产者-消费者问题有一群生产者进程在生产产品,并将这些产品提供给消费者进程去消费。为使生产者进程与消费者进程能并发执行,在两者之间设置了一个具有n个缓冲区的缓冲池,生产者进程将其所生产的产品放入一个缓冲区中;消费者进程可从一个缓冲区中取走产品去消费。尽管所有的生产者进程和消费者进程都是以异步方式... 阅读全文

posted @ 2015-08-25 17:58 Susake 阅读(422) 评论(0) 推荐(0) 编辑

2015年8月3日

【树状数组】单点更新区间查询

摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include const double PI=acos(-1.0);///3.1... 阅读全文

posted @ 2015-08-03 16:38 Susake 阅读(353) 评论(0) 推荐(0) 编辑

【伸展树】

摘要: #include #include #include __gnu_pbds::tree , __gnu_pbds::splay_tree_tag, __gnu_pbds::tree_order_statistics_node_update> sp_t;int main(int argc, char ... 阅读全文

posted @ 2015-08-03 16:37 Susake 阅读(292) 评论(0) 推荐(0) 编辑

【KMP】

摘要: char S[100] = "oooSusakeooo", P[100] = "Susake";int s_next[100];int KMP(int pos, int len1, int len2){ int i = pos, j = 1, k = 0; s_next[1] = 0; ... 阅读全文

posted @ 2015-08-03 16:36 Susake 阅读(212) 评论(0) 推荐(0) 编辑

2015年8月1日

【已知前序中序二叉树求后序二叉树】

摘要: int PreOrder[1000], InOrder[1000];int flag, n;typedef struct BiTNode { int data; struct BiTNode *LChild, RChild;} BiTNode, *BiTree;void PostOrde... 阅读全文

posted @ 2015-08-01 19:14 Susake 阅读(243) 评论(0) 推荐(0) 编辑

【已知中序后序二叉树求前序二叉树】

摘要: int InOrder[1000], PosterOrder[1000];typedef struct BiTNode { int data; struct BiTNode *LChild, *RChild;} BiTNode, *BiTree;int find(int *InOrder... 阅读全文

posted @ 2015-08-01 19:13 Susake 阅读(244) 评论(0) 推荐(0) 编辑

2015年6月17日

【高精度运算】加,减,乘,比较

摘要: void Susake_add(char *s1, char *s2) { int len1 = strlen(s1), len2 = strlen(s2), len, i; int a[N] = {0}, b[N] = {0}; for(i = 0; i len2 ? l... 阅读全文

posted @ 2015-06-17 15:45 Susake 阅读(270) 评论(0) 推荐(0) 编辑

【动态规划】The least round way

摘要: B. The least round waytime limit per test5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere is a square matrix n ... 阅读全文

posted @ 2015-06-17 15:39 Susake 阅读(585) 评论(0) 推荐(0) 编辑

2015年6月14日

【设计模式】Prototype Pattern

摘要: main.cpp#include "Prototype.h"#include using namespace std;int main(int argc, char *argv[]) { Prototype *p = new ConcreatePrototype(); Proto... 阅读全文

posted @ 2015-06-14 18:12 Susake 阅读(237) 评论(0) 推荐(0) 编辑

2015年6月13日

【设计模式】Singleton Pattern

摘要: main.cpp#include "Singleton.h"#include using namespace std;int main(int argc, char *argv[]) { Singleton *sgn = Singleton::Instance(); return... 阅读全文

posted @ 2015-06-13 17:16 Susake 阅读(221) 评论(0) 推荐(0) 编辑

2015年6月10日

【设计模式】AbstractFactory

摘要: main.cpp#include "AbstractFactory.h"#include "Product.h"#include using namespace std;int main(int argc, char *argv[]) { AbstractFactory *cf1 = ... 阅读全文

posted @ 2015-06-10 17:30 Susake 阅读(199) 评论(0) 推荐(0) 编辑

2015年6月9日

【设计模式】Factory Pattern

摘要: main.cpp#include "Factory.h"#include "Product.h"#include using namespace std;int main(int argc, char *argv[]) { Factory *fac = new ConcreateFac... 阅读全文

posted @ 2015-06-09 17:15 Susake 阅读(241) 评论(0) 推荐(0) 编辑

导航