T**********y 发帖数: 157 | 1 http://www.ccse.uestc.edu.cn/teacher/teacher.aspx?id=414
所有已经发表论文清单
(发表时间序)
【1】 周涛,傅忠谦,周佩玲,张建荣,张德学,”基于遗传算法的大规模流量
工程问题求解”,计算机应用,2003年第6期,43-45
【2】 杨春霞,周涛,周佩玲,刘隽,基于Multi_Agent的股市经济系统建模与
分析,自动化理论、技术与应用卷十,中国科学技术大学出版社,2003年,596-601(
中国自动化学会第18届青年学术年会会议论文集)
【3】 周佩玲,许民,赵亮,周涛,”混沌信号奇异性检测与外界冲击度量”,
数据采集与处理,Vol.19,195-198,2004
【4】 周涛,徐俊明,刘隽,”图直径和平均距离极值问题研究”,中国科学技
术大学学报,Vol.34,410-413,2004
【5】 周佩玲,杨春霞,周涛,李立文,”虚拟股市建模与混沌分析”,中国科
学技术大学学报,Vol.34,442-448,2004
【6】 T. Zhou, P. ... 阅读全帖 |
|
e********a 发帖数: 262 | 2 The Introduction of Shear Modification to Gurson Model
Sun, 2012-09-23 23:41 - Liang Xue
research
The Introduction of Shear Modification to Gurson Model
I have been asked questions about how the shear modification was introduced
to the Gurson model. I was also asked to compare my modification (see Xue L.
, Constitutive modeling of void shearing effect in ductile fracture of
porous materials, Engineering Fracture Mechanics, 2008, 75(11):3343-3366) to
John Hutchinson's modification (Nahshon, K., H... 阅读全帖 |
|
g******t 发帖数: 11249 | 3 【 以下文字转载自 Military 讨论区 】
发信人: dellp (dellp), 信区: Military
标 题: The U.S. Is Purging Chinese Cancer Researchers From Top Institutions
发信站: BBS 未名空间站 (Sat Jun 15 20:27:51 2019, 美东)
The NIH and the FBI are targeting ethnic Chinese scientists, including U.S.
citizens, searching for a cancer cure. Here’s the first account of what
happened to Xifeng Wu.
https://www.bloomberg.com/news/features/2019-06-13/the-u-s-is-purging-
chinese-americans-from-top-cancer-research
The dossier on cancer researcher Xif... 阅读全帖 |
|
G********A 发帖数: 2851 | 4 呵呵, 给你支个招,老美的太太门通常在周末会写一个“Honey do List”, 把需
要husband帮忙的事情一次性都写上,这样可以共同商讨,省的重复也不伤感情。
A honey do list is a list of chores or household repairs that one spouse may
make for another. Almost invariably, it is the female who makes up this
list for her husband or partner. The honey do list can either be a helpful
reminder of things that need to get done, or a constant drain on a person’s
free time. Though the title of the list is endearing, people aren’t always
sweetly interested in having tasks assig... 阅读全帖 |
|
b***e 发帖数: 1419 | 5 I like your approach. But brute-force.
In fact this one is VERY simple. It's a parity checking problem. If
the burglar is at odd(even) one night, then the next night he's at
even(odd).
So you assume he's at even at the beginning and traverse the street one
pass starting from a even position. If you catch him, then done.
Otherwise, he was at odd in the beginning, and you can traverse the
street once more to catch him. Just like what you show in your diagram.
The invariant is that at each |
|
k***e 发帖数: 556 | 6 终于可以鄙视下小羊了 哈哈
exactly the same problem in programming pearls, binary search chapter
note that, we need to keep loop invariant [l,r) such that a[l]<= wanted
stop when l = r - 1
index> |
|
P********l 发帖数: 452 | 7 binary search find the number 1 less than the value, return the position.
Check if arr[position+1] is the value.
Or just change the invariant condition. simple. |
|
d***d 发帖数: 24 | 8 constant trace --> invariant w.r.t. change of basis |
|
h**k 发帖数: 3368 | 9 Invariance:
调用build_bst时,list_cur总是指向这个树的第一个节点,len记录这个数的节点总数。
每次移动list_cur时,总是在list_cur指向一个树的root时。移动list_cur时,所有在
list_cur前的节点都已经处理完了。
Node * build_bst( Node* &list_cur, int len)
{
if( len == 0 )
return null;
Node* temp = build_bst( list_cur, len/2);
list_cur->left = temp;
temp = list_cur;
list_cur=list_cur->right;
temp->right = build_bst( list_cur, len-1-len/2);
return temp;
}
|
|
p********i 发帖数: 17 | 10 把 while (lo < hi) 变成 while (lo + 1 != hi) 就不需要loop里的if statement了
,loop结束可以直接return hi,因为loop invariant是arr[lo] == 0 && arr[hi] ==
1。mid = (lo+hi)/2最好写成mid = lo + ((hi -lo) >> 1)防止overflow |
|
i**r 发帖数: 40 | 11 A one pass solution:
The loop invariant is that variable contains the largest element
or none; variable contains the 2nd largest element or none.
int A[n];
const int NONE = -999999999; // sentinel
int largest = NONE;
int largest_2 = NONE;
for (int i = 0; i < n; i++)
if (A[i] < largest && A[i] > largest_2)
largest_2 = A[i];
else if (A[i] > largest){
largest_2 = largest;
largest = A[i];
}
if (largest_2 == NONE )
cout |
|
t******e 发帖数: 1293 | 12 没有看Programming Pearls了吧,看了你就知道了
不过我也有点怀疑,按道理来说发表binary search的那篇paper
里面就会有接近实际代码的伪码的了
里面的证明要verify这个code的正确性,就需要用到啥循环的
pre-condition, post-condition,和loop invariant的 |
|
P********l 发帖数: 452 | 13 done利用已知的最大长度来跳过不必要的比较,觉得应该是最优的解法了。
但是代码上还可以改进:
int maxLength(int[] arr) {
if (arr.length < 2)
return arr.length;
// at least, the length contiguous incremental sequence
is 1.
int maxLen = 1;
// checking using the known maximum length
for (int i = maxLen; i < arr.length; i += maxLen) {
// i-maxLen is the starting position of the
sequence, so,
// invariant: arr[i-maxLen-1] >= arr[i-maxLen]
if (arr[i - 1] >... 阅读全帖 |
|
r*******n 发帖数: 3020 | 14 I think it's right.
loop invariant: x[l]<=t<=x[u] and x[l] is left most one.
at end of loop, u = l+1, and you check x[l] and x[u].
I can't find anything you miss.
first
wrote
arr, |
|
i**********e 发帖数: 1145 | 15 Please don't get confuse :)
I don't know what you mean by min leaf node and max leaf node. Is it the
node that has min and max values? If it is, then your definition of balanced
bst is wrong.
The correct definition for a balanced bst is:
A tree whose subtrees differ in height by no more than one and the subtrees
are height-balanced, too.
When you subdivide the array and construct the bst top-down, you are
essentially maintaining the following invariant in each subdivision:
|#nodes in left subtre... 阅读全帖 |
|
i**********e 发帖数: 1145 | 16 Yes you are right, the below invariant is incorrect:
sorted_cum[i]+k >= sorted_cum[j]
It should be the other way around, just like what smallbug123 pointed out:
sorted_cum[i]+k <= sorted_cum[j] , i <= j
Thanks for the correction. I've corrected the mistake in my post at #37.
一些常见面试题的答案与总结 -
http://www.ihas1337code.com |
|
i**********e 发帖数: 1145 | 17 贴一贴我的代码吧,抛砖引玉.
代码已经改了好几遍,尽量简洁,但是有一些部分还是非常 tricky 的.
代码经过严格的测试.
如果你要测试数据,可以站内联系我.
另外要提到的是:
我想这题难度系数还是满大的,网上的解法不一定对,例如这个就有好几个 bug:
http://geeksforgeeks.org/?p=2105
第一,没有得到平均和(他的直接除以二然后 truncate )
第二,测试了有好几个 case 没通过
很多网上的答案都只能够处理 m == n 的情况,看来 m != n 的情况复杂很多,其实不
是. 掌握思路要点后一点也不难,就是要确保这个 invariant 得到满足:
-- 每次从数组 A 和数组 B 去掉的元素个数必须相等.
掌握了以上的每次去除元素的思路,递归就很直接可以写出来,这只是解这道题最简单
的部分,更难的还有以下非常 tricky 的要点:
1)怎么知道递归的终止条件? 应该很容易想到当其中一个数组个数为 1 的时候,就
必须个别处理,不然就会死循环. 而为什么其中数组个数为 2 的时候也必须个别处理
就不是那么明显了.
2)当个别处理 spec... 阅读全帖 |
|
i**********e 发帖数: 1145 | 18 #1 This line of code :
return medianOfThree(min(med1, c), max(med2, a), b);
#2 is the result of refactoring the below (easier to understand):
if (med1 >= b)
return min(med1, c);
else if (med2 <= b)
return max(med2, a);
else /* med1 < b < med2 */
return b;
In real world, I would choose the latter because the logic is clearer. Could
you see why the #1 will always yield the same result as #2?
To answer your 2nd question, assume X = A[i] and Y = B[j], where i=m/2 and j
=n/2.
If (X <= Y), then... 阅读全帖 |
|
i**********e 发帖数: 1145 | 19 MIT 的 handout 里有提出这题的解答,利用 binary search 巧妙的思路.
http://www2.myoops.org/course_material/mit/NR/rdonlyres/Electri
但是我觉得他那里指的 median 定义似乎不完全对:
Suppose that the median is A[i]. Since the array is sorted, it is greater
than exactly i−1 values in array A. Then if it is the median, it is
also greater than exactly j = ceiling(n/2) − (i − 1) elements in
B.
根据以上的定义,两个数组总数 (n) 为偶数时,取的 median 是元素第 n/2 个,而不
是两个相邻元素之平均. 不知道有没有理解错误,请高人指引.
觉得主要难度要找寻当数组总数为偶数时,要找到两个相邻的元素再找平均. 如果要找
一个元素就容易,但是似乎同时... 阅读全帖 |
|
b***e 发帖数: 1419 | 20 This is obviously correct. Just one scan is OK. Set split point j at 1
in the beginning. Let pipe 1 at i = 0 and pipe 2 at k where Sum[j..n] =
Sum[1..n] / 2.
Then we need to loop j from 1 to n, in each step we (maybe) increase i and
k such that the following invariant hold:
1. Sum[0..i] = Sum[0..j] / 2
2. Sum[k..n] = Sum[j..n] / 2 |
|
f****4 发帖数: 1359 | 21 Cong~ bless~
class invariant是啥啊? |
|
i**********e 发帖数: 1145 | 22 LZ,32 的 super cool 应该是 32 才对吧?
因为 32 = 2^5.
刚写了一个程序,利用 binary search 的思路.
首先选定一个 upper bound,也就是 ceiling(log(n)).
然后再 i=2 到 upper bound 每一个做 binary search.
例如,n=32,upper bound = log(32) = 5.
i=2,从 low = 1 到 high = ceiling(n^(1/2))
i=3, 从 low = 1 到 high = ceiling(n^1/3))
..
以此类推...
binary search 的 invariant 就是比较 target 和 middle and middle's next,看哪
一个比较近。如果是离 middle 比较近,那就 middle's next 和它上边的值都可以抛
掉了。相反,那就 middle 和它下边的值就可以抛掉。
这里,我们确保 middle's next 不会大于 high。这个条件可以保证,因为取的是
lower middle = (L+H)/2.
... 阅读全帖 |
|
i**********e 发帖数: 1145 | 23 来自主题: JobHunting版 - 一道G家题 这个 binary search 就可以搞定。
主要就是维持这个 invariant:
// no missing numbers from L to M
if (M-L >= A[M] - A[L])
L = M+1;
// missing numbers are in L to M
else
H = M;
至于结束条件,这个留给大家讨论一下了 :) |
|
i**********e 发帖数: 1145 | 24 来自主题: JobHunting版 - 一道G家题 不好意思,我刚看了你们之前的帖子才发现
这题对 invariant 的要求还要更深入些
我现在纸上谈兵说完了,我写个程序测试一下哈 |
|
i**********e 发帖数: 1145 | 25 Solving this problem does not require the knowledge of where the pivot is,
even though this is O(log N).
Applying binary search by changing the invariant will do, and is O(log N).
The code will be more elegant. |
|
y*******g 发帖数: 6599 | 26 来自主题: JobHunting版 - 有点绝望了 15分钟太快了点,
是不是你code的时候和面试官交流不够?
拿到题目要多问条件,limit,有想法后和面试官交流,一边说一边改进,
coding的时候多交流
比如
对每个参数有什么要求,invalid input是throw exception还是return error code,
定义一个变量说一下做什么用的,为什么选int不用bool,用array不用list 等等
写一个loop就谈一谈怎么保证loop invariant |
|
y*******g 发帖数: 6599 | 27 小题目,比如atoi,merge,Binary search的变体, 10-15min是上限吧。
不过不能为了速度忽视交流。问题要问,limit,input output要搞清楚,写的时候要
讲思路,我觉得至少每个loop要说明一下loop invariant
其实面试题目的代码不会超过20行,思路清晰了写起来也就5分钟,主要是思路,特殊
条件要想清楚。
大题目时间上可能会因人而异差别大。
参考面试官的一手信息:
The worst candidates don’t even manage to implement the fizzbuzz solution
in 45 minutes. The best implement a memoized solution in 10 minutes
http://thenoisychannel.com/2011/08/08/retiring-a-great-intervie |
|
y*******g 发帖数: 6599 | 28 小题目,比如atoi,merge,Binary search的变体, 10-15min是上限吧。
不过不能为了速度忽视交流。问题要问,limit,input output要搞清楚,写的时候要
讲思路,我觉得至少每个loop要说明一下loop invariant
其实面试题目的代码不会超过20行,思路清晰了写起来也就5分钟,主要是思路,特殊
条件要想清楚。
大题目时间上可能会因人而异差别大。
参考面试官的一手信息:
The worst candidates don’t even manage to implement the fizzbuzz solution
in 45 minutes. The best implement a memoized solution in 10 minutes
http://thenoisychannel.com/2011/08/08/retiring-a-great-intervie |
|
m***n 发帖数: 2154 | 29 public static void dutch(int[] A, int size) {
int low =0, mid = 0, high=size-1;
while(low
low++;
while(high>=0 && A[high]==2)
high--;
mid = low;
//invariants : [0,low) ----> 0
// [low,mid) ---> 1
// [mid, high] ---> unknown
// (high, size-1] ---> 2
while(mid<=high) {
if(A[mid]==0) {
swap(A,mid,low);
... 阅读全帖 |
|
j***y 发帖数: 1069 | 30 好像大多数人对他家都不感冒,不过希望还是可以帮到某些同学。Application
Support Engineer,选的信号处理和C语言。找工作以来第一次碰到印度人面试,说不能
翻书查电脑没说不可以透题。问题如下
信号处理
1. Nyquist sampling theorem
2. aliasing
3. convolution
4. impulse response
5. FIR vs IIR
5. y(n) = x(n)*x(n-1),是不是causal,linear, time-invariant?why?
6. limit sin(x)/x as x->0 ? why?
7. z-transform, Fourier transform 关系
8. 1,2,3 (t=0),0,1,求Z transform,是否causal?
9. what is PSD?
10. PSD of a white noise signal
数学
11. rank of a matrix
12. nullspace of a matrix
13. singular matrix
14. eigen... 阅读全帖 |
|
j***y 发帖数: 1069 | 31 好像大多数人对他家都不感冒,不过希望还是可以帮到某些同学。Application
Support Engineer,选的信号处理和C语言。找工作以来第一次碰到印度人面试,说不能
翻书查电脑没说不可以透题。一边考试一边记题,问题如下
信号处理
1. Nyquist sampling theorem
2. aliasing
3. convolution
4. impulse response
5. FIR vs IIR
5. y(n) = x(n)*x(n-1),是不是causal,linear, time-invariant?why?
6. limit sin(x)/x as x->0 ? why?
7. z-transform, Fourier transform 关系
8. 1,2,3 (t=0),0,1,求Z transform,是否causal?
9. what is PSD?
10. PSD of a white noise signal
数学
11. rank of a matrix
12. nullspace of a matrix
13. singular matrix
... 阅读全帖 |
|
c****e 发帖数: 2127 | 32 非常感谢你的建议
Advanced programming techiques的简介: Emphasis is on the development of
real programs, writing code but also assessing tradeoffs, choosing among
design alternatives, debugging and testing, and improving performance.
Issues include compatibility, robustness, and reliability, while meeting
specifications. Students will have the opportunity to develop skills in
these areas by working on their own code and in group projects.
还有这个Functional Programming不知道是啥?An introduction to the principles
of ... 阅读全帖 |
|
c****e 发帖数: 2127 | 33 非常感谢你的建议
Advanced programming techiques的简介: Emphasis is on the development of
real programs, writing code but also assessing tradeoffs, choosing among
design alternatives, debugging and testing, and improving performance.
Issues include compatibility, robustness, and reliability, while meeting
specifications. Students will have the opportunity to develop skills in
these areas by working on their own code and in group projects.
还有这个Functional Programming不知道是啥?An introduction to the principles
of ... 阅读全帖 |
|
d**********x 发帖数: 4083 | 34 看什么样的code
写个自动机或者quick sort,heap sort这种invariant很明显的东西,bug free是应该
的,至少不应该在维持不变量和退出循环上出问题
如果是那种corner case很多的东西,能覆盖得多一点当然更好啊。
free |
|
s*********l 发帖数: 103 | 35 Q3:
求和,平方求和,三次方求和,...
或者 每项d_(ij)换成exp(-d_(ij)*d_(ij)/sigma), 任取sigma, 再求和,
如果对两个矩阵用以上的运算得到的和都一样的话,可以肯定两个点集是isometry(旋
转平移)
Keywords: euclidean distance matrix, isometry-invariant |
|
s*********l 发帖数: 103 | 36 Q3:
求和,平方求和,三次方求和,...
或者 每项d_(ij)换成exp(-d_(ij)*d_(ij)/sigma), 任取sigma, 再求和,
如果对两个矩阵用以上的运算得到的和都一样的话,可以肯定两个点集是isometry(旋
转平移)
Keywords: euclidean distance matrix, isometry-invariant |
|
g*******n 发帖数: 214 | 37 想到一个算法,O(n^2)不知道行不行:
一个大循环,里面的invariant就是最小的distance就是单个的distance。把这个
distance从数组中删掉,再找到这个distance应该在结果数组中的位置。每次都取最小
值直到这个数组中只剩下一个值。具体来说就是
1.先把distance数组排序,可以得知最小的一个肯定是单个的distance,叫做min。把
这个min从数组中删掉。
2.遍历剩下的值,如果有任意两个值满足min+distanceA=distanceB的话,说明min就说
明distanceB包含了min。那么就删去distanceB。这步做完之后,所有包含min的都被删
掉了。
3.记录第2部被删掉的个数,包括min本身,一共是n个。那么计算C(x,1)+C(length-x,1
)==n中x的值,min就应该在结果数组中从一边开始数,第x-1个没有被赋过值的位置。
4.把剩下的数组作为新的数组,返回到第1步重复。
这样就可以每次得到一个值。具体的实现的话不用用数组,可以用heap来得到最小值。
还有一些细节问题,比如有duplicate: 5+5 和 ... 阅读全帖 |
|
g*******n 发帖数: 214 | 38 想到一个算法,O(n^2)不知道行不行:
一个大循环,里面的invariant就是最小的distance就是单个的distance。把这个
distance从数组中删掉,再找到这个distance应该在结果数组中的位置。每次都取最小
值直到这个数组中只剩下一个值。具体来说就是
1.先把distance数组排序,可以得知最小的一个肯定是单个的distance,叫做min。把
这个min从数组中删掉。
2.遍历剩下的值,如果有任意两个值满足min+distanceA=distanceB的话,说明min就说
明distanceB包含了min。那么就删去distanceB。这步做完之后,所有包含min的都被删
掉了。
3.记录第2部被删掉的个数,包括min本身,一共是n个。那么计算C(x,1)+C(length-x,1
)==n中x的值,min就应该在结果数组中从一边开始数,第x-1个没有被赋过值的位置。
4.把剩下的数组作为新的数组,返回到第1步重复。
这样就可以每次得到一个值。具体的实现的话不用用数组,可以用heap来得到最小值。
还有一些细节问题,比如有duplicate: 5+5 和 ... 阅读全帖 |
|
d**********x 发帖数: 4083 | 39 1 day
remember what is the INVARIANT in your loop. maintain it and you will win
BUG |
|
|
d**********x 发帖数: 4083 | 41 for insertion sort
keep one pointer pointing to the last sorted element. the 'invariant' is,
before and at this point, all elements are sorted.
starting with this idea i hope you can think more clear...though it looks
like not that helpful at first glance |
|
l***i 发帖数: 1309 | 42 对于面试做题,很多同学关心的是我做了多少真题,leetcode刷了多少遍,还有用特定
的programming language刷。个人感觉面试做题其实不完全是你写的code能不能
compile,能不能过所有的testcase,面试是一个跟人交流的过程,对方是在考虑这个
candidate是不是能跟自己,还有自己的team合作。一个什么都不问,听完题目, 甚至
题目都没有听完就开始敲code,或者在白板上开写的candidate绝对不是一个好的
candidate。一个好的面试过程应该是能让对方知道你的thinking process,你写code
的习惯,还有你跟teammate沟通的能力。有人说只要我写出bugfree对方能不让我过么
,这个还真不一定。一个是很难背熟150题,另外一个是如果面试官认真准备过他的题
,总能找到一些办法让你做一些extension。
下面是我总结的做题流程,抛个砖。
1. draw a picture
2. understand the problem, ask any questions if the problem is not clear. I... 阅读全帖 |
|
Z**********4 发帖数: 528 | 43 这个我觉得非常好 谢谢楼主分享!
对于第6点可以解释一下嘛?要写出什么样的invariant?比如题目是在sorted array中
找到一个数,简单的
二分搜索。 |
|
l***i 发帖数: 1309 | 44 invariant在CLRS里面说的很清楚,我说的肯定没有那么到位。一般得想清楚
init : hold before entering loop
in-loop : hold after each iteration
exit : hold after loop completion |
|
z******g 发帖数: 271 | 45 感觉self-contained代码比较好
逻辑比较复杂的循环可以写invariant |
|
l***i 发帖数: 1309 | 46 Let the array A = [a1,a2,...,an], sorted so that a1 <= a2 <= ... <=an
and we are looking for a[i] and a[j] such that a[j] - a[i] = K where K is
given.
start with a[1], and look for the first index t1 such that a[t1] >= a[1] + K
. If a[t1] = a[1] + K, we are done. Otherwise we move to a[2], and check
whether a[2] + K >= a[t1] or not. if equal, we are done, else if less, then
we move to a[3], else greater, then we move t1 to t1 + 1.
Algorithm:
left = 1, right = 1
while (right <= n) { // invariant... 阅读全帖 |
|
|
t*********r 发帖数: 387 | 48 对同胞好点没啥
但我也求同胞们争点气
二叉搜索不会,写码不带invariant
出leetcode easy原题你都搞不定
你叫我咋帮你说话?无米之炊难啊难 |
|
c******n 发帖数: 4965 | 49 你要加invariant comment, always?
I thought that is only considered a plus, not mandatory
comments are kind of mandatory |
|
f*******r 发帖数: 976 | 50 Major outsourcers, largely based in India, are obtaining the lion's share of
the 85,000 H-1B visas issued each year and are paying salaries far below
the prevailing wages for American IT workers -- a violation of the spirit,
if not the letter, of the H-1B rules. New information from U.S. Citizenship
and Immigration Services, the federal agency that oversees the H-1B program,
finally proves what critics have long suspected: H-1B abuse is real and
rampant.
The H-1B program is designed to let U.S. ... 阅读全帖 |
|