This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / 微软题,求解2个排序的数组a[m], b[n].
写个函数, 把他们合并, 当然结果是排序的。
-billhao(bill);
2007-3-16
{68}
(#3557611@0)
-
交作业了int* merge(int *a, unsigned m, int *b, unsigned n)
{
int *c = (int*)malloc(sizeof(int) *(m + n));
for (unsigned i = 0, j = 0, k = 0; k < m + n; ++k)
{
if (j == n || (i < m && a[i] < b[j]))
{
c[k] = a[i++];
}
else
{
c[k] = b[j++];
}
}
return c;
}
-wangqingshui(忘情水);
2007-3-16
{355}
(#3557801@0)
-
插入排序。
-frankwoo(柳五随风);
2007-3-16
(#3557944@0)
-
他们把你当worker用, 要程序, 不要思路:))))
-billhao(bill);
2007-3-16
(#3558027@0)
-
有思路还能写不出来程序?
-frankwoo(柳五随风);
2007-3-16
(#3558047@0)