博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
产生随机数,测试快排
阅读量:7045 次
发布时间:2019-06-28

本文共 1259 字,大约阅读时间需要 4 分钟。

1 #include
2 #include
3 #include
4 #include
5 #include
6 using namespace std; 7 int main() 8 { 9 srand(unsigned(time(0))); 10 freopen("random1.txt","w",stdout); 11 for(int i = 0 ; i < 1000 ; i++) 12 { 13 int a = rand() % 100; 14 cout<< a <<" "; 15 } 16 fclose(stdout); 17 18 } 19 #include
20 #include
21 #include
22 #include
23 #include
24 using namespace std; 25 int fuzhukuaipai(int a[],int i,int j) 26 { 27 int key = a[i]; 28 while(i
=key&&i
a[j])swap(a[i],a[j]); 78 } 79 } 80 } 81 int main() 82 { 83 int a[100000] ; 84 ifstream fin; 85 fin.open("random_number.txt"); 86 for(int i = 0 ; i < 100000 ; i++) 87 { 88 fin>>a[i]; 89 } 90 fin.close(); 91 time_t Start; 92 time_t End; 93 Start = clock(); 94 // QuickSort(a,0,100000); 95 kuaipai(a,0,100000); 96 End = clock(); 97 cout<<"kuaipai-spend:"<
<
>a[i];108 }109 fin.close();110 Start = clock();111 QuickSort(a,0,100000);112 End = clock();113 cout<<"QuickSort-spend:"<
<
>a[i];120 }121 fin.close();122 Start = clock();123 sort(a,a+100000);124 End = clock();125 cout<<"Sort-spend:"<
<

 

转载于:https://www.cnblogs.com/Duskcl/p/4009836.html

你可能感兴趣的文章
Java -Xms -Xmx -Xss -XX:MaxNewSize -XX:MaxPermSize含义记录
查看>>
微信小程序开发之常见BUG
查看>>
汇编指令-MRS(读)和MSR(写)指令操作CPSR寄存器和SPSR寄存器使用(1)
查看>>
Instagram的Material Design概念设计文章分享
查看>>
Jersey VS Django-Rest
查看>>
安装 openCV 2.4.10
查看>>
去哪网实习总结:用到的easyui组件总结(JavaWeb)
查看>>
spring-oauth-server实践:使用授权方式四:client_credentials 模式下access_token做业务!!!...
查看>>
jquery miniui 学习笔记
查看>>
dubbo AdaptiveExtension
查看>>
Scrapy系列教程(1)------命令行工具
查看>>
Using Autorelease Pool Blocks
查看>>
spring-struts-mybatis整合错误集锦
查看>>
Maven 通过maven对项目进行拆分、聚合(重点)
查看>>
TWaver版3D化学元素周期表
查看>>
Java 中最常见的 5 个错误
查看>>
[AWS vs Azure] 云计算里AWS和Azure的探究(2)
查看>>
查看是否安装.NET Framework、.NET Framework的版本号、CLR版本号
查看>>
数据结构基础温故-5.图(下):最短路径
查看>>
调试Release发布版程序的Crash错误(转)
查看>>