高手来做做中软国际面试题

hyj1984 2010-02-24 11:18:00
题目1:一条小溪上7块石头,如图所示:(图就是下面的链接)
http://album.hi.csdn.net/app_uploads/jinder22/20081220/235450716.p.jpg?d=20081220235510403




分别有六只青蛙:A,B,C,D,E,F。A,B,C三只蛙想去右岸,它们只会从左向右跳;D,E,F三只蛙想去左岸,它们只会从右向左跳。青蛙每次最多跳到自己前方第2块石头上。请问最少要跳几次所有青蛙上岸。写出步骤。

题目2:Which of the choices below correctly describes the amount of time used by the following code:(下面那个选项正确地描述了代码运行的调度次数)
n=10;
for(i=1; i <n; i++)
for(j=1; j <n; j+=n/2)
for(k=1; k <n; k=2*k)
x = x +1;
A Θ(n^3)
B Θ(n2logn)
C Θ(n(log n)2)
D Θ(n log n)
E Θ((logn)2)

题目3:Give a one-line C expression to test whether a number is a power of?(这句话不知道咋翻译)
题目4:What is wrong with the following code?(下面代码哪错了)
char *p;
*p = malloc(10);

题目5:Write a c++ function to take two sorted single linked lists as parameters and marge them into one then return it (Please write data structure first)(请写一个C++程序对两个排好序的单链表合成一个大的单链表)
S1.1->4->5, S2:2->3->6, result="1->2->3->4->5->6"

题目6:Write a function to get the second maximum number in an integer array.(请写程序返回一个数组中第2大的数)
int getsecond(int a [])

题目7:Write a c++ program that will delete itself after execution.(写一个程序,该程序执行完后自己删除自己)

题目8:What is the difference between calloc and malloc?(calloc malloc区别是什么?)

题目9:what's wrong with the call fopen("c:\newdir\file dat"."r")?


题目10:A quad-tree, starting from the root node, could consist of many nodes: leaf-node and non-leaf node. Each non-leaf node may have 1 to 4 child nodes; each node has an internal value V, if not null, which would refer to any node in the same quad-tree. Hierarchically, depth of node describes the distance between a node in a tree and the tree’s root node, the farther the distance is, the deeper the node is at in the tree. The goal is to find all the nodes in the quad-tree which fulfills the condition: the value of node A refers to a node B in the same tree, where the depth of node A is larger than the depth of node B. The input would be a data structure representing the quad-tree; the output would be a data structure representing the list of nodes fulfilling the conditions. (四叉树由许多个节点组成,其起点是根节点。节点有两种:叶子节点,非叶子节点,其中每个非叶子节点又可分出1到4个子节点。每一节点都包含其内在值V。如果这个值非空,则可以表示同一四叉树上任一节点的值。从等级上划分,节点的深度表明节点与根节点之间的距离:距离越远,节点的深度越深。目的是找出四叉树上所有符合以下条件的节点:在同一树上,节点A 的值引用节点B,但其深度要大于节点B的深度。输入的数据结构以四叉树形式呈现,输出的数据结构以链表呈现)

Q1: Describe how you will solve the problem and explain why you pick the solution. The best answer should consider multiple solutions and choose the optimal one in terms of time and space complexity, and explain why you choose this one. (Q1,说明你如何解决这个问题并解释你为什么采取那种解决方式。最好的回答应是在多种解决方案中根据时空的复杂程度选择最佳的一种并解释你为什么选择该项)


Q2: Implement the solution you have chose in the previous question in any programming language. A function is required for the code you write so that others can call it. You should define the major data structures you are going to use in the function. (把你在前一问题中选择的解决方法运用于任一程序语言中。要求你的函数具有一种功能,以便其他人能对调用它?你需要界定你将在这一函数中使用的主要数据结构)

Q3: Provide list sufficient test cases that can validate the code you write in Q2 working correctly as expected. The best answer should consider various typical cases for different usages by function callers, including common cases, boundary cases, error case, etc.(提供一组有效的测试用例证明你在问题2中的编码达到了预期目标。最好的回答应考虑到函数调用者,对不同类型实例的不同使用,这些实例包括普通实例,边缘实例和错误实例等)

...全文
3487 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
empty808 2011-06-02
  • 打赏
  • 举报
回复
我打算去面试,但是大多数不会做
baobaoyajiaoban 2010-04-13
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 hyj1984 的回复:]
引用 6 楼 vssvss 的回复:
有不少题和08年是一样的。
你是零几年毕业的呀,2.23去你们公司面试,就是在中软大厦里的。有个老总长的挺胖,还带眼镜,总问一些奇怪的问题
[/Quote]
中软大厦?都搬了呀!难道笔试不在公司本部?明明在融科和欣正呀!
烈火蜓蜻 2010-02-26
  • 打赏
  • 举报
回复
2 :选B 2nLog(n)
3 :不懂英文
4 :不是 *P=malloc(10); 而是 p=malloc(10);
5 :太简单了不做
6 :和找最大数差不多
liujunsummer 2010-02-26
  • 打赏
  • 举报
回复
中软国际是做外包的吗
jiyan1221 2010-02-26
  • 打赏
  • 举报
回复
中软国际咋样啊,不错么?
hhc123 2010-02-26
  • 打赏
  • 举报
回复
这相当于一条船,一个老师利用这船送几个胖瘦高短的学生过河的例子差不多
marey_marey111 2010-02-26
  • 打赏
  • 举报
回复
汗一个。。。。。中软国际有想象的那么好么?
vssvss 2010-02-26
  • 打赏
  • 举报
回复
我当时做第6题的时候不是用的冒泡,只用一次遍历就出来;当时的技术面试管觉得很不错。
这里我用就当全部是int型的数据了。
方法是,设置2个int变量
int max,secondMax;
secondMax=a[0];
max= -32767;
for(int i=1;i<num;i++)
{
if (a[i] > max)
{
secondMax = max;
max = a[i];
}
else if (a[i] > secondMax)
{
secondMax = a[i];
}
}
return secondMax;


建议:
中软的题目还是有点难的的,题目是英文的,还有英文写作,时间上可能不是很宽裕。
我记得后面的编程题诗选择性的题目,还有附加题,附加题其实不是很难,主要是考算法和2叉树的。
技术面试中也会有现场编程,这时候你的程序得考虑周全了,其中包括内存溢出,越界等,还会问一些数据库管理和测试方面的东西,记得最清楚的解释要求写测试案例,这里他们看得比较重。
英语面试没什么难的,只要你技术过,4级过了 一般没什么问题。

祝你们好运。
flyerwing 2010-02-26
  • 打赏
  • 举报
回复
引用 2 楼 xray2005 的回复:
不是高手,也不打算去中软国际。不做。

没意思
vssvss 2010-02-26
  • 打赏
  • 举报
回复
有不少题和08年是一样的。
vssvss 2010-02-26
  • 打赏
  • 举报
回复
哇 我们公司的题啊 还有点难度哦
hyj1984 2010-02-26
  • 打赏
  • 举报
回复
引用 6 楼 vssvss 的回复:
有不少题和08年是一样的。
你是零几年毕业的呀,2.23去你们公司面试,就是在中软大厦里的。有个老总长的挺胖,还带眼镜,总问一些奇怪的问题
hyj1984 2010-02-25
  • 打赏
  • 举报
回复
引用 2 楼 xray2005 的回复:
不是高手,也不打算去中软国际。不做。
你就做吧。看着蛮像高手的。
鸭梨山大帝 2010-02-24
  • 打赏
  • 举报
回复
C/C++ 略懂的飘过,呵呵
xray2005 2010-02-24
  • 打赏
  • 举报
回复
不是高手,也不打算去中软国际。不做。
绿色夹克衫 2010-02-24
  • 打赏
  • 举报
回复
第一题可以用bfs,分支不算太多,以前写过一个,现在一下子找不到,LZ可以自己在论坛里搜索一下。
第二题应该是n*log(n)
第三题:n&(n-1)=0
第五题:归并排序,写过很多遍了
第六题:相比较次数少的话用堆排序,n+log(n)次

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧