我的面试(五)
八月十五中秋佳节,俺再一次赶赴北京。为我的北漂奔波!足足用了一天的时间,晚上11点才回到家。
这家公司在上地,好远。做的题和以前面试做的差不多不想再赘述了。当一件事情干过n次之后就趋于麻木,我现在对于面试这件事情就是在麻木的临界状态。不想那么多了。慢慢来吧!
这次是测试工程师,不知道能不能行!面试官说就剩下跟我谈薪水问题了。等等吧,如果一个公司连5K都拿不出来,这样的公司也不用去了。
出道题数组a[0,1……n-1]中的数是乱序,有数b[0,1……m],m<n,不新建数组把a中数升序放到b中,编吧。
/// <summary>
/// 数组排序
/// </summary>
/// <param name="a1">带排序数组</param>
/// <param name="lenth">排序后新数组长度</param>
/// <returns>排完的数组</returns>
static int[] SortArray(int[] a1, int lenth)
{
if (lenth < a1.Length)
{
throw new Exception("越界了,甭玩儿啦!");
}
int[] b1 = new int[lenth];
b1[0] = a1[0];
for (int i = 1; i < a1.Length; i++)
{
![](/Images/OutliningIndicators/InBlock.gif)
int low = 0;
int high;
if (i <= lenth - 1)
{
high = i - 1;
}
else if (a1[i] > b1[lenth-1])
{
continue;//都比最大的大了,还玩啥?!
}
else
{
high = lenth - 1;
}
while (low <= high)
{
int mid = (low + high) / 2;
if (a1[i] < b1[mid]) high = mid - 1;
else low = mid + 1;
}//找出来往哪插
if (i <= lenth - 1)
{
for (int j = i - 1; j >= high + 1; j--)
b1[j + 1] = b1[j];
}
else
{
for (int j = lenth - 2; j >= high + 1; j--)
b1[j + 1] = b1[j];
}//腾地方,把插入点后边的向后挪。(满了的最后一个就不要了)
b1[high+1] = a1[i];//都给您老腾地儿了还不赶快进去!
}
return b1;//得,打完收工。
}//看不懂的去看《数据结构》的插入排序法
这家公司在上地,好远。做的题和以前面试做的差不多不想再赘述了。当一件事情干过n次之后就趋于麻木,我现在对于面试这件事情就是在麻木的临界状态。不想那么多了。慢慢来吧!
这次是测试工程师,不知道能不能行!面试官说就剩下跟我谈薪水问题了。等等吧,如果一个公司连5K都拿不出来,这样的公司也不用去了。
出道题数组a[0,1……n-1]中的数是乱序,有数b[0,1……m],m<n,不新建数组把a中数升序放到b中,编吧。
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
posted on 2007-10-01 15:24 gyhanonline 阅读(353) 评论(1) 编辑 收藏 举报