C++中简单的排序问题
来源:百度知道 编辑:UC知道 时间:2024/05/23 17:14:46
要求:
待排序的元素个数不固定
有多种排序方法可供选择
有人会吗?帮个忙。。。
希望能写出多种方法,可以追加分数
谢谢
详谈:QQ331012005
有插入,shell,快速排序
//mysortclass.h
#ifndef __MYSORTCLASS__
#define __MYSORTCLASS__
#include <vector>
#include "StudentClass.h"
using namespace std;
class MySortClass
{
public:
static vector<StudentClass> DoInsertSort(vector<StudentClass> inData);
static vector<StudentClass> DoShellSort(vector<StudentClass> inData);
static vector<StudentClass> DoQuickSort(vector<StudentClass> inData);
static const int GetCost(){return icost;};
static void SetShow(bool b=true){bshow=b;};
static int icost;
static bool bshow;
private:
static void QuickSort (vector<StudentClass>& list, const int left, const int right);
static void InterChange(vector<StudentClass>& list, int location1, int location2);
static void Insert (vector<StudentClass>& list, StudentClass s, const