Skip to content

szabo-krisztian/SortItOut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Merge sort

Sort it out

Sorting algorithms visualized with simple animation using the SDL2 C library. Due to the abstraction layers, it is quite easy to add new algorithms to the code, each implementing the abstract Algorithm class:

class Algorithm
{
public:
    Algorithm(std::atomic<bool> &isAppRunning) : m_isAppRunning(isAppRunning) {}
    virtual ~Algorithm() = default;

    virtual void Sort(SyncVector &numbers) = 0;

protected:
    std::atomic<bool> &m_isAppRunning;
};

Few parameters can be changed in the main.cpp file:

int main(int argc, char* argv[])
{
    tlr::AppConfig appConfig =
    {
        .windowWidth = 800,
        .windowHeight = 600,
        .windowPosX = 100,
        .windowPosY = 100,
        .numberCount = 100,
        .swapTimeInMillis = 5
    };

    tlr::App app(appConfig);
    app.Run();
    
    return 0;
}

About

Sorting algorithms visualized using SDL library

Topics

Resources

Stars

Watchers

Forks