Files
SortLab/include/sorters/SelectionSorter.hpp
T
2026-03-02 15:48:49 +03:00

23 lines
422 B
C++

#pragma once
#include "Sorter.hpp"
class SelectionSorter : public Sorter {
public:
SelectionSorter();
void step(Array& array) override;
bool isFinished() const override;
std::string getName() const override;
void reset() override;
private:
enum class Phase { FINDING_MIN, SWAPPING, NEXT };
int i_;
int j_;
int minIndex_;
int n_;
bool finished_;
Phase phase_;
};