算法练习
文章平均质量分 73
zhengxu_Lee
这个作者很懒,什么都没留下…
展开
-
最下失败组合数字
using namespace std; int GetMinNum(const string& str, int &oFiledMin) { int a_count[10] = { 0 }; for (auto& c : str) { int value = (int)c-48; ++a_count[value]; } int least = 0; ...原创 2018-03-23 09:31:34 · 218 阅读 · 0 评论 -
教你读懂深度优先的套路
深度优先遍历的基本框架其中:a是当前获得的部分解;k是搜索深度;input是其它输入;is_a_solution(a,k,input)判断当前的部分解向量a[1...k]是否是一个符合条件的解;construct_candidates(a,k,input,c,ncandidates)根据目前状态,构造这一步可能的选择,存入c[]数组,其长度存入ncandidates;process_solutio...原创 2018-03-29 17:20:40 · 348 阅读 · 0 评论 -
多线程交替打印abcd,持续5s
一个互斥锁和条件变量的应用示例。#include <stdio.h> #include <stdlib.h> #include<unistd.h> #include<string.h> #include<pthread.h> static int num=0; #define THREAD_NUMBER 4 pthread_mutex_...原创 2018-05-16 20:53:17 · 335 阅读 · 0 评论