Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2014-08-26 17:19:16
阅读次数:
191
利用数组做为地图,利用数字为各种元素,用简单的语句做出推箱子的效果。staticvoidMain(string[]args){Console.Write("第一关,请按空格键开始");//程序开始,在屏幕上显示这个提醒,然后下面就开始读取键盘输入的按键:ConsoleKeyInfocf=Consol...
分类:
其他好文 时间:
2014-08-26 17:10:06
阅读次数:
363
skynet 利用内置的原子操作来实现的一个读写锁,重点是理解 ”full memory barrier“ ,UNPv2 中利用互斥和条件变量实现的读写锁。前者是在硬件支持的情况下,显得简单明了,站的层次不一样。
源码贴出来:
struct rwlock {
int write;
int read;
};
static inline void
rwlock_in...
分类:
Web程序 时间:
2014-08-26 11:43:26
阅读次数:
284
在TCP连接开始到结束连接,之间可能会多次传输数据,也就是服务器和客户端之间可能会在连接过程中互相传输多条消息。理想状况是一方每发送一条消息,另一方就立即接收到一条,也就是一次write对应一次read。但是,现实不总是按照剧本来走。MINA官方文档节选:TCP guarantess deliver...
分类:
Web程序 时间:
2014-08-26 11:02:47
阅读次数:
346
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be o...
分类:
其他好文 时间:
2014-08-26 00:18:35
阅读次数:
290
//二分法查询 Console.Write("请输入数据个数:"); int n = Convert.ToInt32(Console.ReadLine()); int[] no = new int[n]; ...
分类:
其他好文 时间:
2014-08-25 13:16:04
阅读次数:
201
缓冲的几个基本概念
缓冲的作用:减少系统read和write的次数。
全缓冲
系统标准I/O缓冲区被写满时才进行真正的I/O操作。
磁盘文件一般使用全缓冲
全缓冲使用malloc来分配缓冲区
行缓冲
系统遇到换行符时进行真正的I/O操作。
Te...
分类:
其他好文 时间:
2014-08-25 11:57:14
阅读次数:
214
//降序排序 Console.Write("请输入数据的个数:"); int n = Convert.ToInt32(Console.ReadLine()); int []sz=new int[n]; ...
分类:
其他好文 时间:
2014-08-25 01:02:03
阅读次数:
267
namespace ConsoleAppSyncDownload{ class Program { static void Main(string[] args) { WebClient webClient = new WebClient(); //Console.Write("输入下载文件地址:"...
分类:
Web程序 时间:
2014-08-24 23:44:53
阅读次数:
309
看了unix环境高级编程第三章,把代码也都自己敲了一遍,另主要讲解了一些IO函数,read/write/fseek/fcntl;这里主要是c函数,比较容易,看多了就熟悉了。对fcntl函数讲解比较到位,它可以得到和改变打开文件的属性(只读,只写等等,注意后面和stat区别),下面记录了自己在学习.....
分类:
其他好文 时间:
2014-08-24 22:09:33
阅读次数:
291