Sunteți pe pagina 1din 1

Sorting Visualisation Tools

WinSort is a tool for visualising different sorting algorithms. WinSort was produced by
various project students, and a QUT Teaching and Learning Grant. It was produced to help
students to understand exactly how some common sorting algorithms work.

Dots is another sorting visualisation tool which was developed by John Hynd (former IT
lecturer).

Note: When downloading these files in the S Block labs, first make sure that the Pop-
up Blocker is turned off (under Tools). Also you will probably have to repeat the
process of Saving the file twice.

Download winsort.exe, double click, select File => NewSort =>Sort Bar View

You will see 26 coloured bars of varying sizes. Click on the I button (Insertion Sort)

When sort is finished, write down the number of COMPARES and SWAPS. See bottom
right hand corner.

Select Operation => Restore Array, click on Q button (Quicksort). Note the number of
COMPARES and SWAPS.

Quicksort will have done less swaps than the Insertion Sort.

Select Data => Large Array. Select Delay, change to 0.0

Now select I and note the figures for COMPARES and SWAPS. Restore the array
(Operation etc), and run Quicksort noting the results.

Use a calculator to divide the Swaps on Large Array for Insertion by the Swaps on 26 values
for Insertion. The result will be about 16. A general rule for Insertion Sort increase the
amount of data by N, will result in N2 increase in Swaps (true for Compares as well)

Repeat this calculation for Quicksort result. The result will be around 5.5 (for the
mathematically inclined only the increase is N * ln N )

Select Data => Reverse Sorted Array. Run Insertion sort, note results.

Select Data => Reverse Sorted Array. Run Quicksort, note results.

Download Dots.jar, double click. Three windows will open, Dots control, Dots view and
Dots help. In Dots control, click on Insertion ( can click on Faster while sort is running
to speed it up ) Set Delay to 1, click on Reset, click Quick

Set Delay to 0, run Insertion note time, then reset and run Quick noting time.

Moral of the demo: Use Quicksort on large volumes of data.

Try out WinSort and Dots some more for yourself when you have time.

S-ar putea să vă placă și