02 2016 档案

摘要:以前没怎么用过,下面简单看一看Random是怎么用的。 假如被问到如何利用对一个数组进行shuffle,那么我们可以有一些简单的方法。 1. 使用系统自带的sort,然后传入一个Comparator,里面带一个double r = Math.random(),代码如下 这个Time Complexi 阅读全文
posted @ 2016-02-12 08:27 YRB 阅读(674) 评论(0) 推荐(0)
摘要:刚做了两道Two Sigma OA。 还是两道老题, Friend Cycle和Longest Chain。 Friend Cycle可以用Union Find来做。优化的时候因为矩阵是沿对角线对称,所以可以只扫描一半的元素,也可以加上Path Compresssion和 weight。 Longe 阅读全文
posted @ 2016-02-08 12:34 YRB 阅读(2322) 评论(0) 推荐(0)
摘要:大学时候学物理实验的时候接触过线性回归,现在忘记了...还得重新拾起来。学习不扎实耽误了多少时光... sigh Suppose that you time a program as a function of N and produce the following table. N seconds 阅读全文
posted @ 2016-02-02 11:46 YRB 阅读(264) 评论(0) 推荐(0)