Skip to content

Visualization of five sorting algorithms using pictures of nature

Notifications You must be signed in to change notification settings

WaltherTrgovac/Picture-Sorter-Visualization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Picture Sorter Visualization 📶

📝 About the project

This project is a visualization of five different sorting algorithms using different pictures of nature. It shows how five different sorting methods (Bubble Sort, Insertion Sort, Selection Sort, Heap Sort, and Quick Sort) work using pictures. Although this is a more fun way of visualizing sorting algorithms, it is not the best visualization method when it comes to learning. It features 10 pictures of nature that can be sorted by pressing buttons with a desired sorting algorithm.

🎥 Demo

🔑 How it works

The project is written in Python using pygame library. Firstly, a random image is loaded. In order to cut the image into the bars, function pygame.Surface.blit() is used. Each image is 1100 pixels wide and split into bars that are 2 pixels wide. In order to use the sorting algorithms, first we need a list of numbers. In this case we store starting position of each bar in a list. This way we can easily sort the starting positions of each bar and visualize the process.

📖 Getting Started

Requirements: Python and pygame (Python package)

In order to start the program, you have to download the File Picture Sorter Visualization. It is very important that the following files are all in the same directory: main.py, Pictures and Fonts. The easiest method is just to download the File Picture Sorter Visualization.

🔨 How to use

After executing the program you will see a window with random unsorted picture of a nature. In order to see the sorting visualization process, you need to press a button selecting your desired sorting algorithm. After that all you need to do is press the button 'Sort' and the sorting process will start. During the sorting process you can not pause it and you need to wait until the end of the process. After that you may reset the image or you can select next random picture of nature to sort.

📜 Credits

In order to get a general idea of how to visualize sorting algorithms in Python I have watched video tutorials from Tech with Tim. With the help of Clear Code I have managed to implement animated buttons.

📄 License

MIT License

Copyright (c) [2023] [Walther Trgovac]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Visualization of five sorting algorithms using pictures of nature

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages