ABOUT SORTING

Sorting a sequence of items is one of the pillar of Computer Science.

A sorting algorithm is an algorithm that organizes elements of a sequence in a certain order. Since the early days of computing, the sorting problem has been one of the main battlefields for researchers. The reason behind this is not only the need of solving a very common task but also the challenge of solving a complex problem in the most efficient way.



SORTING is an attempt to visualize and help to understand how some of the most famous sorting algorithms work. This project provides two standpoints to look at algorithms, one is more artistic (apologies to any real artist out there), the other is more analytical aiming at explaining algorithm step by step.



This project does not want to teach the theory of sorting algorithms, there are amazing resources, books and courses for this purpose. SORTING is for the ones who want to see these algorithms under a different ligth and hopefully appreciate the processing and brain power behind these piece of genius that in many ways have changed the way we live.

Sorting Algorithms as Artwork

Generative Art is one of the ways to represent computational processes. Transforming the data generated by an autonomous system into the features of an artwork can lead to unexpected results.



SORTING was born to create visual representations of sorting algorithms with the hope of finding visual patterns. It turned out that the visual footprints of algorithms are unique and differ from each other and they look gorgeous.

Analyzing Sorting Algorithms

Another way of looking at this project is as an analytical tool to study how sorting algorithms work. Beside generating visuals representations, SORTING provides a walk-through that guides the reader step after step along the process of ordering a lists of integer numbers.

All the steps are tracked: comparison operations happening behind the scene through the use of animated indicators, changes of position of items through animations and arcs, and temporary storing of items.



SORTING makes it possible to compare how different algorithms behave with different initial set of items.



The inversions chart adds a measure of the distance from the final goal both in terms of inversions and operations(comparisons and exchanges) that can be tracked during the execution of the algorithm.

Inversion Count

The Inversion count for a sequence of items indicates the distance of that sequence from being sorted. Simply put if the sequence is already sorted then the inversion count is equal to 0, instead if the sequence is sorted in reverse order than the count is the maximum.



An inversion is a pair of positions in a sequence where the elements there located are out of their natural order.



Formally, a pair of elements (A[ i ] , A[ j ]) of a sequence A is called an inversion if i<j and A[ i ]>A[ j ].

Aknowledgments

There have been many attempts to visualize sorting algorithms. Some of them have been great resources for the completion of SORTING, among them Sorting Algorithm Animations (D. R. Martin), sortvis.org (A. Cortesi) and Visualization and comparison of sorting algorithms in C# (R. Kanasz).

Huge thanks go to Alex Conconi for reviewing the project and giving invaluable suggestions and feedback.