摘要: #ifndef INSERT_SORT_H#define INSERT_SORT_H#include<assert.h>template<class T,int n>void swap(T* s,int i,int j){ assert((i<n)&&(j<n)); T temp=s[i]; s[i]=s[j]; s[j]=temp;}template<class T,int n>void insert_sort(T* s){ int i=1,j; for(i=1;i<n;i++) for(j=i;j>0;j--) { 阅读全文
posted @ 2010-04-12 20:49 樱色布 阅读(171) 评论(0) 推荐(0) 编辑
摘要: #ifndef SELECT_SORT_H#define SELECT_SORT_H#include<assert.h>template<class T,int n>void swap(T* s,int i,int j){ assert((i<n)&&(j<n)); T temp=s[i]; s[i]=s[j]; s[j]=temp;}template<class T,int n>T get_smalllest(T* s,int i){ assert(i<n); T result=i; for(;i+1<n;i++) 阅读全文
posted @ 2010-04-12 20:45 樱色布 阅读(312) 评论(2) 推荐(1) 编辑