This is a demo application that allows to test 3 implementations of external merge sort:
- straight merge sort
- natural merge sort
- balanced 2-way merge sort
As input it accepts a file with integers.
On output it shows sorted array in asc/desc order and statistics for each implementation, collecting number of array splits and merges.
Before building application you need the following software installed on your machine:
- Java 8 or higher (see system requirements)
- Maven build tool
Go to project directory and run command mvn package
in terminal.
In target
directory JAR file named mergesort-app-1.0.0.jar
will be created.
Before running application you need Java 8 installed on your machine.
In terminal run command java -Xmx24M -jar target/mergesort-app-1.0.0.jar
. Graphical window will be opened.
In graphical window there is an Input panel with 3 tabs:
-
Consists of textarea. Example input:
5 4 3 2 1 0
First number is array size. All numbers are separated with space character.
Input array will be saved in input file.
-
File.
Has a "Select" button that opens a window to choose a file with input array.
Format is the same as for text variant.
-
Generate.
Has three input fields:
- array size. Mandatory field
- min value. Optional field (default: -2,147,483,648)
- max value. Optional field (default: 2,147,483,647)
Will generate array of random integers, which will be written to input file.
Data from active tab will be used as input data for sorting.
You can select ascending or descending order in 'Order' panel.
After specifying input click 'Sort' button.
Output will be available in 3 resources.
- Console. Will have all logs including input data, interim results, output array and statistics.
For performance goals, only first 5 and last 5 elements of array are printed.
- Screen. Will have full input, output arrays and statistical information.
- Text file. Will have full output array. Filename format:
output_date-time.txt