⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sort.h

📁 ssd5 op5的答案
💻 H
字号:
#ifndef SORT_H
#define SORT_H

#include <ctime>
#include <cstdlib>
#include <iostream>

using namespace std;

const int ITERATIONS=10; 
const int MIN_SIZE=3000; // Smallest size list to test
const int MAX_SIZE=24000; // largest size list to test

const int BEST_CASE = 1;
const int AVG_CASE = 2;
const int WORST_CASE = 3;

class sort
{
  protected: 
    clock_t start_time;
    int numbers[MAX_SIZE]; // list of numbers to sort (and then sorted)
    long numswaps; //incremented after each swap
    int how_many, workload_type;
    

    void swapNumbers (int x, int y);
    void startTiming();
    clock_t getElapsedTime();

    virtual void init(int how_many, int workload_type) = 0;
    

    public:
      void reset();
      void report ();
      void printNumbers();
    
      virtual void sortNumbers() = 0;
    
    
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -