08 2015 档案

摘要:socket通信 socket是应用层与TCP/IP协议族通信的中间软件抽象层,是一组接口。工作原理如下: 具体过程:服务器端先初始化socket,然后与端口绑定(bind),对端口进行监听(listen),调用accept阻塞,等待客户端连接。在这时如果有个客户端初始化一个socket,然后... 阅读全文
posted @ 2015-08-27 17:01 蚂蚁吃大象、 阅读(684) 评论(1) 推荐(0)
摘要://https://leetcode.com/problems/number-of-digit-one/Given an integer n, count the total number of digit 1 appearing in all non-negative integers less ... 阅读全文
posted @ 2015-08-17 21:20 蚂蚁吃大象、 阅读(281) 评论(0) 推荐(0)
摘要:并查集主要解决图的连通性问题,比如: 1、随意给你两个点,让你判断它们是否连通; 2、问你整幅图一共有几个连通分支;初始化:void init(int size) { for(int i = 0; i using namespace std;int N, E, Answer;int pre... 阅读全文
posted @ 2015-08-02 21:43 蚂蚁吃大象、 阅读(249) 评论(0) 推荐(0)
摘要:KMP算法一、传统字符串匹配算法/* * 从s中第sIndex位置开始匹配p * 若匹配成功,返回s中模式串p的起始index * 若匹配失败,返回-1 */int index(const std::string &s, const std::string &p, const int sIndex... 阅读全文
posted @ 2015-08-02 18:14 蚂蚁吃大象、 阅读(207) 评论(0) 推荐(0)