由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 能有人详细讲一下这两道google的面试题吗?
相关主题
几道面试题:memory, sort, 等阅读Robert Sedgewick的"algorithms in C"的感受
两道某公司面试题Floating number question
[合集] 两道面试题有谁看过youtube上的算法课吗?
请教两道linux面试题目一道算法题 (转载)
这样一道面试题 (转载)-debug求助看了那个招聘的帖子,自觉需要把 atoi温习一下。赶紧的
这两种写法面試时候你喜欢哪种?INTEGER搜索求建议
这个条件语句如何写?complexity of set operation?
紧急求助,C语言面试题两道小题
相关话题的讨论汇总
话题: write话题: algriothm话题: two话题: transform话题: mins
进入Programming版参与讨论
1 (共1页)
s*********e
发帖数: 17
1
The first one: Write the code using an optimization algriothm to calcuate
the
intersection and union of two sets. (30 mins)
The second one: Write the code for an algriothm to transfrom the index in
excel to the number, and write a class to call this function without
declearing an object. for example: "A, B, C,....AB,AC,..BA,BB,....AAA,AAB,..
."
, transform to "1,2,3,.....", and also transform back.(30 mins)
r********g
发帖数: 1351
2
g*****g
发帖数: 34805
3

sort two sets individually, merge
O(mlogm) + O(nlogn)
..
base 26 radix, no difference from converting back/forward binary to integer
just change 2 to 26

【在 s*********e 的大作中提到】
: The first one: Write the code using an optimization algriothm to calcuate
: the
: intersection and union of two sets. (30 mins)
: The second one: Write the code for an algriothm to transfrom the index in
: excel to the number, and write a class to call this function without
: declearing an object. for example: "A, B, C,....AB,AC,..BA,BB,....AAA,AAB,..
: ."
: , transform to "1,2,3,.....", and also transform back.(30 mins)

r********g
发帖数: 1351
4
1.two ways:
(1) hash.
(2)sort first.
Two array A and B, Let array C to store the intersection of A and B
after sorting A and B.Let m be the size of A, n be the size of B.
i=0,j=0;
while(i {
if(A[i]< B[j]) i++;
if(A[i]>B[j]) j++;
else
{
add A[i] to C;
i++;j++;
}
}
then the union is A-C+B;
Time complexity maximum(O(mlogm),O(nlogn))
2.this is 26-based numbers. You should convert between 10-based numbers and
26-based numbers. Simulation is ok.
to call
p*u
发帖数: 2454
5

yes, static method should be what they asked for.
c*****z
发帖数: 182
6
for question two, how about make the function static and just
call in this way:
object:func()?

【在 r********g 的大作中提到】
: 1.two ways:
: (1) hash.
: (2)sort first.
: Two array A and B, Let array C to store the intersection of A and B
: after sorting A and B.Let m be the size of A, n be the size of B.
: i=0,j=0;
: while(i: {
: if(A[i]< B[j]) i++;
: if(A[i]>B[j]) j++;

1 (共1页)
进入Programming版参与讨论
相关主题
两道小题这样一道面试题 (转载)-debug求助
两道Java面试问题这两种写法面試时候你喜欢哪种?
Please help me prove SUM(logi) is Omega(nlogn) (转载)这个条件语句如何写?
两道M软件大公司的最新面世算法题 (转载)紧急求助,C语言面试题
几道面试题:memory, sort, 等阅读Robert Sedgewick的"algorithms in C"的感受
两道某公司面试题Floating number question
[合集] 两道面试题有谁看过youtube上的算法课吗?
请教两道linux面试题目一道算法题 (转载)
相关话题的讨论汇总
话题: write话题: algriothm话题: two话题: transform话题: mins