Data Files for SortDisplay

The data files that SortDisplay can digest consist of 3 types of lines:

1.  The "Elements" line which lists the initial data values of the array to be sorted.  This is the first line in the file.  For instance:

Elements 5 2 3 2 7

2."swap" lines that indicate two positions in the current data array and whether or not they should be swapped.  For instance:

swap 3 0 true
(swap data in positions 3 and 0)

swap 1 2 false
(highlight but do not swap data in positions 1 and 2)


3. "move" lines that indicate that an element in one position should be moved to another position:

move 7 3
(move data from position 7 to position 3.  Position 7 data-value will show as 0.)

4. "move" lines that move an element from a position in the data array to a "holding position" (outside the visual portion of the data array), or from a "holding position" back to a normal position in the data array.

For this "holding position", use the (non-existent) position equal to the length of the data array plus one (data.length+1).

For instance, in the insertion sort below, suppose we want to move the element in position 3 (value = 2) to its correct position: 1...

Elements 1 3 5 2
move 3 5

(move position 3 to the holding position = data.length+1)
move 2 3
move 1 2
move 5 1
"swap" lines will be written to the output file for you when you use the function:
WriteSwap(int from, int to, boolean swapping)

"move" lines will be written to the output file for you when you use the function:
WriteMove(int from, int to)