Stefano CappelliniSC

AI • Deep Learning • Machine Learning • Software Engineering


MagieSort is a tool designed to help students learn sorting algorithms. It shows how the algorithms move, the comparisons they make and it highlights the differences existing among them.

MagieSort is a Java Application that aims to make the learning of sorting algorithms easier and fun. Learning these algorithms can be cumbersome. Sometimes students find difficult to grasp how they work and to visualise how different they are. Yes, every book on algorithms is full of interesting examples, but they are static! An interactive tool is surely one of the best ways to learn these algorithms.


MagieSort offers a lot of features. The list is not exhaustive and it will never be because new features will be added in the near feature. The best way to discover them all is to try MagieSort. It's free!

Colours and indexes

MagieSort highlights every index used during the execution (using different colours) and it colours the collection's cells to help you deeply understand what the algorithm is doing and where.

MagieSort uses a lot of colors. In this picture you can clearly see the cells the algorithm is currently working on (coloured in green) and where the various indexes are (the arrows).

Auxiliary data structures

MagieSort shows every single step of the algorithms even the steps needed to build auxiliary data structures. For example, have you ever wondered how the heap is built during the first phase of the Heap Sort algorithm?

Here MagieSort is explaining and showing how the heap is built during the first phase of the Heap Sort Algorithm.


Don't forget the recursion! MagieSort shows the recursive calls in a truly effective way: the part of the collection considered by a recursive step is moved down a bit. Looking at the various levels you can quickly understand the recursive stack.

Simply by looking at the various heights you can understand the entire recursive stack.

In place algorithms

MagieSort makes the understanding of the differences between an in-place algorithm and a not-in-place algorithm extremely simple. How? By showing the auxiliary extra space needed by the algorithms during their execution. By looking at the next picture you can clearly see that Merge Sort needs extra space during its merge phase.

Here the Merge Sort is using extra space during its merge phase!

MagieSort's descriptions

And last but not least, MagieSort describes what the algorithm is doing! Every single step, every single decision will be described in detail. Look!

How to use it?

To use MagieSort simply follow these three steps.

Step 1 - Generate the collection

The first step is deciding the collection to sort. MagieSort can generate randomized, monotonic increasing and monotonic decreasing collection. In this way you can test the algorithms on their average, best and worst scenarios. You can decide the size of the collection: it can vary from 5 to 20 elements. This is a learning tool, so bigger sizes are useless.

Step 2 - Choose the algorithm

The second step is choosing which algorithm to study. MagieSort offers a lot of algorithms (and many other will be added in the near feature!). The algorithms currently covered are: Bubble Sort, Selection Sort, Shaker Sort, Insertion Sort, Gnome Sort, Merge Sort, Quick Sort and Heap Sort.

Step 3 - Interact

Once you have generated the collection and chosen the algorithm, just click start. The algorithm will be executed step-by-step. You have the control. Using the next button, you can decide when to proceed.

Try it!

So, are you a Professor, a student or simply someone who wants to understand how sorting algorithms work? Give MagieSort a try. It's completely free.