摘要: void MaxLengthCore(char *cur,char *pre,int *max,int cursum) { if(*cur == '\0') return ; if(pre !=NULL && *cur == *pre) { ++cursum; if(cursum > *max) *max = cursum; pre = cur; MaxLengthCore(++cur,pre,... 阅读全文
posted @ 2018-11-24 19:40 执著的追求 阅读(274) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define NUM 3 int n=0; pthread_mutex_t t_mutex; pthread_cond_t t_cond; void *Execute(void *p) { int i=0; int para = (int)p; for(;i<10;i++) { pthread_mutex_lock(&t_mutex);... 阅读全文
posted @ 2018-11-24 19:39 执著的追求 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 输入:{5,3,4,8,6,7} 输出:4即{3,4,6,7} 阅读全文
posted @ 2018-11-24 19:38 执著的追求 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 1 class MyQueue 2 { 3 public: 4 MyQueue(); 5 bool Get(int *&p); 6 bool Put(int a); 7 int GetLength(); 8 private: 9 struct Node * rear; 10 struct Node * front; 11 int length; 12 }; 13 14 MyQ... 阅读全文
posted @ 2018-11-24 19:37 执著的追求 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1 struct QNode 2 { 3 struct Node *front; 4 struct Node *tail; 5 unsigned int len; 6 }; 7 8 9 struct Qlist 10 { 11 struct QNode *qlist; 12 pthread_mutex_t m_... 阅读全文
posted @ 2018-11-24 19:36 执著的追求 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 push(const T& element) 2 { 3 if(queue1.size()>0)//如果queue1不为空则往queue1中插入元素 4 queue1.push(element); 5 else if(queue2.size()>0)//如果queue2不为空则往queue2中插入元素 6 queue2.push(element); 7 else//如果两个队列... 阅读全文
posted @ 2018-11-24 19:34 执著的追求 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 1 void Rotate(char *start,char *end) 2 { 3 if(start == NULL || end == NULL) return ; 4 while(start<end) 5 { 6 char temp = *start; 7 *start = *end; 8 *end = temp; 9 --end;++start; 10 } 11 } 1... 阅读全文
posted @ 2018-11-24 19:34 执著的追求 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 单链表的快排 快排的非递归实现 阅读全文
posted @ 2018-11-24 19:33 执著的追求 阅读(567) 评论(0) 推荐(0) 编辑
摘要: KMP算法 BF算法 阅读全文
posted @ 2018-11-24 19:31 执著的追求 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 1 void AdjustHeap(int *a,int n,int cur) 2 { 3 int i,tmp; 4 for(i=2*cur+1;ia[i]) 9 break; 10 tmp = a[cur]; 11 a[cur] = a[i]; 12 a[i] = tmp; 13 cur = i; 14 } 15 } 16 17 void HeapSort(int *a,int n... 阅读全文
posted @ 2018-11-24 19:29 执著的追求 阅读(98) 评论(0) 推荐(0) 编辑