摘要: 1. Linux中线程互斥/同步有哪几种方式?线程互斥:互斥锁:• pthread_mutex_lock • pthread_mutex_unlock线程同步:1) 条件变量: • pthread_cond_wait • pthread_cond_signal; • pthread_cond_bro... 阅读全文
posted @ 2015-08-06 18:29 Ryan in C++ 阅读(485) 评论(0) 推荐(0) 编辑
摘要: 1.给N张扑克牌和一个随机函数,设计一个洗牌算法 [CC150]关键点:如何保证每张牌等概率地出现在每个位置伪码如下for i in 1…n: randomly select a card j from [1,i] swap card i with card jC++实现 1 void ... 阅读全文
posted @ 2015-08-06 13:35 Ryan in C++ 阅读(1147) 评论(0) 推荐(0) 编辑