开发面试很好的题目

gw713675 2009-07-14 06:51:20
第一题: Let U and V be two sorted array of integers.Merge them into one array X such that X is also sorted.


第二题: Given a binary tree,write a program to output its preorder traversal sequence using non-recursive algorithm.For example,for a tree that has 3 nodes. 'A' is the root,'B' and 'C' are the children of 'A',the output would be 'ABC'


第三题:Wirte a program to compute the sum of two large positive integers which are represented as string. Example prototype: string Add(string a,string b)

...全文
87 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingmax54212008 2009-07-16
  • 打赏
  • 举报
回复
mark
superzxf 2009-07-15
  • 打赏
  • 举报
回复
太阳,能不能写成中文啊?看见鸟语就烦

fengying0529 2009-07-15
  • 打赏
  • 举报
回复
学习了
aotian798 2009-07-15
  • 打赏
  • 举报
回复
飘过 哈哈
iceswordman 2009-07-15
  • 打赏
  • 举报
回复
sorry,my english is poor.
shen8686 2009-07-15
  • 打赏
  • 举报
回复
飘过
超维电脑科技 2009-07-15
  • 打赏
  • 举报
回复
学习
starts_2000 2009-07-15
  • 打赏
  • 举报
回复
都是些基本,题目还是不错的
chenchangxiong 2009-07-15
  • 打赏
  • 举报
回复
这也太基本了吧 算我飘过 飘啊飘
topming 2009-07-15
  • 打赏
  • 举报
回复
第二个题目写错了吧!第二个你写的不是前序排序,第三个没有看明白是什么意思!
十八道胡同 2009-07-14
  • 打赏
  • 举报
回复
恩,都是好题目。
vicqqq 2009-07-14
  • 打赏
  • 举报
回复
        static string LargeNumAdd(string a, string b)
{
int len1 = a.Length;
int len2 = b.Length;
int carry = 0; //进位
Stack<int> stack1 = new Stack<int>(len1);
Stack<int> stack2 = new Stack<int>(len2);
int resultLen = len1 >= len2 ? len1 : len2;
Stack<int> stack3 = new Stack<int>(resultLen+1);
for (int i = 0; i < len1; i++)
{
int num = Convert.ToInt32(a[i].ToString());
stack1.Push(num);
}
for (int i = 0; i < len2; i++)
{
int num = Convert.ToInt32(b[i].ToString());
stack2.Push(num);
}
int tempResult = 0;
for (int i = 0; i < resultLen; i++)
{
int r1 = stack1.Count > 0 ? stack1.Pop() : 0;
int r2 = stack2.Count > 0 ? stack2.Pop() : 0;
tempResult = r1 + r2 + carry;
if (tempResult > 9)
{
stack3.Push(tempResult - 10);
carry = 1;
}
else
{
stack3.Push(tempResult);
carry = 0;
}
}
if (carry > 0) stack3.Push(carry);
StringBuilder sb = new StringBuilder();
while (stack3.Count > 0)
{
sb.Append(stack3.Pop());
}
return sb.ToString();
}
vicqqq 2009-07-14
  • 打赏
  • 举报
回复
int l1 = U.Length, l2 = V.Length;
int[] X = new int[l1 + l2];
U.CopyTo(X, 0);
for (int i = 0; i < l2; i++)
{
X[l1] = V[i];
l1++;
}
Array.Sort(X);



public class Node
{
public string Value;
public Node Left;
public Node Right;
}
static void Traversal(Node root)
{
Queue<Node> queue = new Queue<Node>();
if(root!=null) queue.Enqueue(root);
Node temp;
while (queue.Count>0)
{
temp = queue.Dequeue();
Console.WriteLine(temp.Value);
if(temp.Left!=null) queue.Enqueue(temp.Left);
if(temp.Right!=null) queue.Enqueue(temp.Right);
}
}
zhoujinfeng 2009-07-14
  • 打赏
  • 举报
回复
我是很想帮你的
但是我的英语水平有限
gw713675 2009-07-14
  • 打赏
  • 举报
回复
能帮助一下就帮,不能别这样说
ICanUseThisID 2009-07-14
  • 打赏
  • 举报
回复
Do homework yourself!
yuangang1011 2009-07-14
  • 打赏
  • 举报
回复
学习
txwd0033 2009-07-14
  • 打赏
  • 举报
回复
应该是基本的数据结构的问题
qqty_cn_0011 2009-07-14
  • 打赏
  • 举报
回复
ding...

110,536

社区成员

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

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

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