摘要: 思路: 暴力,复杂度为 $O(n^3)$,超时 类似3Sum。这几道题相对暴力能够减小复杂度的主要原因是暴力里面的两层循环都执行了,而后面的这种解法通过比较使内部的两层循环减少到了一层,所以时间复杂度由 $O(n^3)$ 减小到了 $O(n^2)$。 阅读全文
posted @ 2017-06-06 20:50 UniMilky 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 思路 直接暴力,$O(n^4 log(n))$,不出意外的超时了。。 class Solution { public: vector threeSum(vector& nums) { vector res; int i,j,k; int len = nums.size(); for(i = 0; i 阅读全文
posted @ 2017-06-06 15:03 UniMilky 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 思路: 首先假设选择两侧,如果想让体积变大,应该让小的一侧移动,因为想要使小的一侧遇到比原来大的高度。每次都移动小的,直到左右两侧相遇,记录移动过程中产生的最大值。复杂度为$O(n)$ 阅读全文
posted @ 2017-06-05 22:52 UniMilky 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 两种方法: 直接遍历,复杂度为 $O(n^2)$ class Solution { public: vector twoSum(vector& nums, int target) { vector a; for(int i = 0; i twoSum(vector& nums, int target 阅读全文
posted @ 2017-06-05 22:40 UniMilky 阅读(107) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2017-05-25 20:14 UniMilky 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Convex hull(Convex envelope): In mathematics, the convex hull or convex envelope of a set X of points in the Euclidean plane or in a Euclidean space ( 阅读全文
posted @ 2017-05-25 15:09 UniMilky 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 仿射集合: 如果通过集合C中任意两个不同点的直线仍然在集合C中,那么称集合C是仿射的。 非平凡解: 矩阵代数的中的定义,nontrivial=nonzero AX=0, 行列式|A|~=0, 则X有非平凡解, 否则, 只有平凡解X=0. 因为任何线性空间的子空间都过零点, 所以明显的等于0的时候解是 阅读全文
posted @ 2017-05-20 08:25 UniMilky 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Benders分解(MILP问题) 对于公式6里面的规划问题,y是一个固定值,考虑其对偶问题,有: 所以原始问题可以变为如下形式: 。 解此问题,提供上界。 当 非空时,内部的规划问题要么无界要么有可行解。如果无界,那么其解空间对应的极线满足以下条件: 如果有可行解,那么可行解可用极点表示。因此,问 阅读全文
posted @ 2017-05-17 23:24 UniMilky 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 极点 In mathematics, an extreme point of a convex set S in a real vector space is a point in S which does not lie in any open line segment joining two p 阅读全文
posted @ 2017-05-17 08:12 UniMilky 阅读(292) 评论(0) 推荐(0) 编辑
摘要: "光滑函数" 光滑函数(smooth function)在数学中特指无穷可导的函数,也就是说,存在所有有限阶导数。 "严格凸函数" 在区间I上有定义,当且仅当曲线y=f(x)的切线恒保持在曲线以下,则成f(x)为凸函数.若除切点之外,切线严格保持在曲线下方,则称曲线f(x)为严格凸的. "max函数 阅读全文
posted @ 2017-05-15 23:11 UniMilky 阅读(418) 评论(0) 推荐(0) 编辑