设为首页 加入收藏

TOP

归并排序
2014-11-23 21:27:55 来源: 作者: 【 】 浏览:10
Tags:归并 排序
#include
using namespace std;


void sort(int a[],int first,int mid,int last,int temp[])
{
	int i=first;
	int j=mid;
	int count=0;
	while(1)
	{
		if(a[i]first)
	{
		int mid=(first+last)/2;
		merge(a,first,mid,temp);
		merge(a,mid+1,last,temp);
		sort(a,first,mid,last,temp);
	}

}
void main()
{
	
	int a[]={1,4,7,9,12,2,5,9,11,13};
	int last=sizeof(a)/sizeof(int);
	int* p =new int[last]();
	merge(a,0,last,p);
	for(int i=0;i 
 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇POJ 2377 Bad Cowtractors 下一篇URAL 1081

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何理解c语言指针和 (2025-12-27 01:19:11)
·为什么C标准库没有链 (2025-12-27 01:19:08)
·玩转C语言和数据结构 (2025-12-27 01:19:05)
·MySQL 基础入门视频 (2025-12-26 23:20:22)
·小白入门:MySQL超详 (2025-12-26 23:20:19)