算法分析和设计

源代码在线查看: sort.cpp

软件大小: 1260 K
上传用户: superdavid
关键词: 算法分析
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include "Sort.h"
				#include   //DWORD,   GetTickCount()
				
				void main()
				{	
					Sort s;
					int a[NUM],b[NUM],c[NUM],d[NUM],e[NUM];
					srand((unsigned)time(NULL));
					for(long i=0;i					{
						a[i]=rand()*rand()/1000000;
						b[i]=c[i]=d[i]=e[i]=a[i];
					}
				
				
					cout					DWORD dwStart1 = GetTickCount();
					s.BubbleSort(a,NUM);
					DWORD dwEnd1 = GetTickCount();
					cout				
					DWORD dwStart2 = GetTickCount();
					s.HeapSort(b,NUM);
					DWORD dwEnd2 = GetTickCount();
					cout				
					DWORD dwStart3 = GetTickCount();
					s.InsertSort(c,NUM);
					DWORD dwEnd3 = GetTickCount();
					cout				
					DWORD dwStart4 = GetTickCount();
					s.MergeSort(d,NUM);
					DWORD dwEnd4 = GetTickCount();
					cout				
					DWORD dwStart5 = GetTickCount();
					s.QuickSort(e,0,NUM-1);
					DWORD dwEnd5 = GetTickCount();
					cout				
					cout					char cs;
					cin>>cs;
				}
				
				
				
							

相关资源