摘要: Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.[解题思路]图的遍历有两种方式,BFS和DFS这里使用BFS来解本题,BFS需要使用queue来保存neighbors但这里有个问题,在clone一个节点时我们需要clone它的neighbors,而邻居节点有的已经存在,有的未存在,如何进行区分?这里我们使用Map来进行区分,Map的key值为原来的node,value为新clone的node,当发现一个node未在map中时说明这个node还未被clone,将 阅读全文
posted @ 2013-10-04 21:26 feiling 阅读(1077) 评论(0) 推荐(0) 编辑
摘要: 程序设计语言的指令都可以访问虚存区域中的程序和数据,可以通过给每个进程一个唯一的不重叠的虚存空间来实现进程隔离;可以通过使两个虚存空间的一部分重叠来实现内存共享ref:操作系统精髓与设计原理第5版 p52 阅读全文
posted @ 2013-10-04 13:09 feiling 阅读(902) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?[解题思路]人生最悲催的事是刚面完试,leetcode就把我面试的题目给刷出来了。。。。1.O(n) time complexity O(n) space complexity cou 阅读全文
posted @ 2013-10-04 12:00 feiling 阅读(3275) 评论(0) 推荐(1) 编辑