huayd

写点什么吧

C++博客 联系 聚合 管理
  0 Posts :: 2 Stories :: 0 Comments :: 0 Trackbacks

/*
Name: BubbleSort
Copyright: 2006-2007
Author: 哈米
Date: 04-11-06 18:09
Description:
*/

#include<iostream>
#include<algorithm>

template <class Type>
void BubbleSort(Type* array,int n)
{
    for(int i=n-1;i>=0;--i)
        for(int j=0;j<i;++j)
   if(array[j]>array[j+1])
    std::swap(array[j],array[j+1]);
   
}

posted on 2006-11-05 00:12 哈米家园 阅读(21) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理