摘要: mmap基础概念mmap是一种内存映射文件的方法,即将一个文件或者其它对象映射到进程的地址空间,实现文件磁盘地址和进程虚拟地址空间中一段虚拟地址的一一对映关系。实现这样的映射关系后,进程就可以采用指针的方式读写操作这一段内存,而系统会自动回写脏页面到对应的文件磁盘上,即完成了对文件的操作而不必再调用... 阅读全文
posted @ 2015-07-20 10:35 胡潇 阅读(265839) 评论(36) 推荐(158) 编辑
摘要: 系统调用操作系统的主要功能是为管理硬件资源和为应用程序开发人员提供良好的环境,但是计算机系统的各种硬件资源是有限的,因此为了保证每一个进程都能安全的执行。处理器设有两种模式:“用户模式”与“内核模式”。一些容易发生安全问题的操作都被限制在只有内核模式下才可以执行,例如I/O操作,修改基址寄存器内容等... 阅读全文
posted @ 2015-07-19 12:24 胡潇 阅读(67087) 评论(17) 推荐(64) 编辑
摘要: 由于倒排索引文件往往占用巨大的磁盘空间,我们自然想到对数据进行压缩。同时,引进压缩算法后,使得磁盘占用减少,操作系统在query processing过程中磁盘读取效率也能提升。另外,压缩算法不仅要考虑压缩效果,还要照顾到query processing过程的解压缩效率。总的来说,好的索引压缩算法需... 阅读全文
posted @ 2015-07-17 08:08 胡潇 阅读(7166) 评论(1) 推荐(2) 编辑
摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv... 阅读全文
posted @ 2015-09-01 22:41 胡潇 阅读(767) 评论(0) 推荐(0) 编辑
摘要: A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message conta... 阅读全文
posted @ 2015-09-01 17:15 胡潇 阅读(561) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjace... 阅读全文
posted @ 2015-09-01 15:33 胡潇 阅读(785) 评论(0) 推荐(0) 编辑
摘要: Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.解题思路:题目乍一看很简单,将矩阵当前为0的位的行列都置为0;问题在于:当遇到一个已知0时,不能立刻将其行列置0,因为这样... 阅读全文
posted @ 2015-09-01 14:59 胡潇 阅读(486) 评论(0) 推荐(0) 编辑
摘要: Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem stat... 阅读全文
posted @ 2015-08-31 22:39 胡潇 阅读(582) 评论(0) 推荐(0) 编辑
摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
posted @ 2015-08-31 22:23 胡潇 阅读(622) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].解题思路:1、将区间按照起始... 阅读全文
posted @ 2015-08-31 10:40 胡潇 阅读(577) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x,n).解题思路:求浮点数的幂次方,注意可能为负数次幂;可以使用二分搜索的思想,当n为偶数时,x^n = x^(n/2) * x^(n/2),因此只需要求得一半的幂次方,将结果平方,就得到所求结果。解题步骤:1、递归最底层,n == 0 时,返回1;2、求出t = po... 阅读全文
posted @ 2015-08-30 16:11 胡潇 阅读(479) 评论(0) 推荐(0) 编辑
摘要: Given an array of strings, group anagrams together.For example, given:["eat", "tea", "tan", "ate", "nat", "bat"],Return:[ ["ate", "eat","tea"], ["na... 阅读全文
posted @ 2015-08-30 15:43 胡潇 阅读(602) 评论(0) 推荐(0) 编辑
摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.解题思路:1、先取出k个list的首元素,每个首元素是对应list中的最小元素,组成一个具有k个结点的最小堆... 阅读全文
posted @ 2015-08-28 12:05 胡潇 阅读(891) 评论(0) 推荐(0) 编辑