HACKMIND

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年5月13日

摘要: #include<iostream>using namespace std;int main(){ int temp=0; int a[]={1,5,6,3,4,7,8,6,3}; for(int i=0;i<9;i++) for(int j=0;j<9;j++) if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } for(i=0;i<9;i++) cout<<a[i]<<" "; return 0;} 平均代码复杂度为O(n^2) 阅读全文
posted @ 2013-05-13 22:19 HACKMIND 阅读(153) 评论(0) 推荐(0)