摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals[1,3],[6,9], insert and merge[2,5]in as[1,5],[6,9].Example 2:Given[1,2],[3,5],[6,7],[8 阅读全文
posted @ 2013-06-30 11:43 一只会思考的猪 阅读(175) 评论(0) 推荐(0) 编辑
摘要: MIT的算法课,看到一个很新颖的Partition的方法,代码很简洁,在也不用判断几个边界(original i#include using namespace std;//Partition a[begin,end)/** [p| = x | unknow ] i j 6 10 13 5 8 3 2 || x=6 i j j if ok 6 5 13 10 8 3 2 i j =x MIT 算法导论课的Partition算法 Partition(A,p,q) //... 阅读全文
posted @ 2013-06-30 00:21 一只会思考的猪 阅读(217) 评论(0) 推荐(0) 编辑