Redian新闻
>
盛传的某新加坡朋友的求职信
avatar
盛传的某新加坡朋友的求职信# Joke - 肚皮舞运动
j*e
1
1. http get和post的区别,追问到了具体http包里面的内容
2. 对web 安全的了解
3. 数据库问题,建表记录employee,department等
4. int数组,找出和为零的数字对 (老题了)
5. int数组,kth largest number (老题也有春天)
6. web问题,用户登录这些怎么在客户端记录(答曰饼干),后面一直追问
到php的session
avatar
G*o
2
avatar
p*2
3

第五题空间复杂度什么要求?

【在 j********e 的大作中提到】
: 1. http get和post的区别,追问到了具体http包里面的内容
: 2. 对web 安全的了解
: 3. 数据库问题,建表记录employee,department等
: 4. int数组,找出和为零的数字对 (老题了)
: 5. int数组,kth largest number (老题也有春天)
: 6. web问题,用户登录这些怎么在客户端记录(答曰饼干),后面一直追问
: 到php的session
:

avatar
s*s
4
赞 red handed
avatar
j*e
5
面试官没说,我说建个大小为K的heap,然后worst case
是O(N * logK),他就说OK了,没往下问。

【在 p*****2 的大作中提到】
:
: 第五题空间复杂度什么要求?

avatar
h*n
6
LOL
avatar
w*x
7
第5题用selection algorithm吧
avatar
s*y
8
lol

【在 G***o 的大作中提到】

avatar
j*e
9
median of median 那个?

【在 w****x 的大作中提到】
: 第5题用selection algorithm吧
avatar
x*i
10
there's still no vacancy because the position was eliminated upon the
manager's death~~~

【在 G***o 的大作中提到】

avatar
w*x
11
int GetKth(int a[], int n, int k)
{
assert(a && n > 0 && k <= n);

int* p = a;
int m = n;
while (k > 1)
{
int nMid = m/2;
swap(p[0], p[nMid]);

int i = 1;
int j = m-1;
while (i < j)
{
if (p[i] <= p[0])
i++;
else if (p[j] > p[0])
j--;
else swap(p[i], p[j]);
}

swap(p[0], p[i]);

if (i >= k)
m = i;
else
{
p = a+1+i;
m -= i+1;
}
}

return p[0];
}
avatar
st
12
death certificate...
avatar
j*e
13
没看懂,介绍下思路?
感觉while(k>1)会导致死循环吧?好像while里没有改变k,也米有break

【在 w****x 的大作中提到】
: int GetKth(int a[], int n, int k)
: {
: assert(a && n > 0 && k <= n);
:
: int* p = a;
: int m = n;
: while (k > 1)
: {
: int nMid = m/2;
: swap(p[0], p[nMid]);

avatar
c*e
14
Dear Applicant,
We're sorry to tell you that there is still no vacancy available. You just
misunderstand the cause-and-effect relationship between the death of manager
and vacancy. In fact, it is the elimination of the position caused the
death of the manager. 你懂的.

【在 G***o 的大作中提到】

avatar
w*x
15
刚才随手写的, 改正:
int GetKth(int a[], int n, int k)
{
assert(a && n > 0 && k <= n);
int* p = a;
int m = n;
while (k > 1)
{
int nMid = m/2;
swap(p[0], p[nMid]);
int i = 1;
int j = m-1;
while (i <= j)
{
if (p[i] <= p[0])
i++;
else if (p[j] > p[0])
j--;
else swap(p[i], p[j]);
}
swap(p[0], p[j]);
if (i >= k)
m = i;
else
{
p = a+1+i;
m -= i+1;
k -= i+1;
}
}
return p[0];
}
avatar
w*1
16
LOL
avatar
w*x
17
k忘缩小了, i <= j 不是 i < j, 和p[j]交换不是p[i], bug啊~~
avatar
w*z
18
功课做到家了

【在 G***o 的大作中提到】

avatar
j*e
19
看明白了。如果pivot选的很倒霉,worst case会到O(N^2)?
一般再用median of median来选pivot,那就麻烦了

【在 w****x 的大作中提到】
: 刚才随手写的, 改正:
: int GetKth(int a[], int n, int k)
: {
: assert(a && n > 0 && k <= n);
: int* p = a;
: int m = n;
: while (k > 1)
: {
: int nMid = m/2;
: swap(p[0], p[nMid]);

avatar
w*g
20
the position is "terminated"

manager

【在 c******e 的大作中提到】
: Dear Applicant,
: We're sorry to tell you that there is still no vacancy available. You just
: misunderstand the cause-and-effect relationship between the death of manager
: and vacancy. In fact, it is the elimination of the position caused the
: death of the manager. 你懂的.

avatar
w*x
21

考虑worst case的话那快排比堆排序慢多了. 但是一般情况下快排比对排序快,这体差
不多的感觉

【在 j********e 的大作中提到】
: 看明白了。如果pivot选的很倒霉,worst case会到O(N^2)?
: 一般再用median of median来选pivot,那就麻烦了

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。