- 博客(6)
- 收藏
- 关注
原创 问题记录
1.之前一直有个问题困扰:socket多线程通信中,调用某一线程执行read(非阻塞socket)读取数据时,如果数据在read执行之前或者read执行完之后发过来?岂不错过了数据?实际上,对每一个端口,已到达的数据会放在对应的缓存中(目前还不知道这个缓存具体是什么),read其实是从缓存中读取数据,那如果发送方太快,缓存被填满,新来的数据被丢弃从而无法接收到怎么办,其实这种情况不会发生,因为TC
2017-03-23 01:03:48 202
原创 蛇形矩阵
#include#include#include#include#include#include#include#define N 30005#define PINF 0x7fffffff#define NINF 0#define MAX(a,b) (a<b?a:b)using namespace std;int a[100][100];int main(){
2016-04-07 13:15:10 414
原创 Tree Traversals Again (25)
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac
2015-03-30 18:36:16 402
原创 关于二分法的深入理解及实例
int binary_search(int *a,int x,int y,int v) //经典二分查找 闭区间{ int m; while(y>=x) { m=x+(y-x)/2; if(a[m]==v) return m; else if(a[m]>v) y=m-1; else x=m+1; } return -1;}思想:对于以排序的闭区间[x,y],计算出中
2015-03-25 20:22:15 1212
转载 Reversing Linked List
Reversing Linked List Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you mu
2015-03-21 19:12:56 344
转载 一道TCL的笔试题---递归
在下面这个程序片段中的划线处填上适当的表达式,使之逆序输出数组元素。--------------------------------------------------------------------------------void recur(int a[], int k) { int tmp; if(__
2014-03-15 22:25:24 1736 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人