An Example of Sorting

This page demonstrates an algorithm for Sorting, which is the problem of taking an array of elements and arranging them so that they are in proper order (either dictionary order, in the case of words, or numeric order in the case of numbers). Sorting is one of the most fundamental interesting problems in algorithms.

This form permits you to enter data and have it sorted into ascending order. Enter your data in the "Data" field, one item per line. If you wish the data to be treated as numeric, mark the box labelled "Treat data as numbers". When you are ready to go, press the "Sort Values" button, and they will be sorted in order!

Note: blank lines will be ignored, and not considered part of the data, but all other characters (including spaces) will be considered part of the data to be sorted.


Data:

Treat data as numbers

Actions:


Click this button to sort the data in ascending order.


Click this button to shuffle the data into random order.


Click this button to reverse the order of the data.



Click this button to insert a shuffled list of pre-defined strings.


Click this button to insert a list of random numbers.



Clears the data field and re-sets the form.