mirror of
https://github.com/koloideal/SortLab.git
synced 2026-06-10 02:15:31 +03:00
23 lines
428 B
C++
23 lines
428 B
C++
#pragma once
|
|
#include "Sorter.hpp"
|
|
|
|
class InsertionSorter : public Sorter {
|
|
public:
|
|
InsertionSorter();
|
|
|
|
void step(Array& array) override;
|
|
bool isFinished() const override;
|
|
std::string getName() const override;
|
|
void reset() override;
|
|
|
|
private:
|
|
enum class Phase { COMPARING, SHIFTING, INSERTING, NEXT };
|
|
|
|
int i_;
|
|
int j_;
|
|
int n_;
|
|
float key_;
|
|
bool finished_;
|
|
Phase phase_;
|
|
};
|