Skip to content

prvnsmpth/merge-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MERGE SORT IMPLEMENTATION
=========================

Praveen Sampath
prvn.exe@gmail.com

The main sort method is present in the file sort.c.
This method depends on other auxiliary methods defined in sort.c and a 
heap implementation in heap.h and heap.c.


Compilation
-----------

$ make sort

Usage
-----

Usage: ./sort [-o output_file] [-b buffer_size] [-a attr_list] input_file

The only required argument is the input file name.

Options:
	
	-o output_file
		Specify output file name. If not specified, the sorted data is written to 'output.bin'.

	-b buffer_size
		Set the buffer size (in bytes). The default buffer size is 100000 bytes.

	-a attr_list
		Specify the attributes to be considered for sorting, separated by comma.
		E.g., -a 3,4 or -a 8,4,-3.
		There should be NO SPACE between attribute index and the comma.
		If no attribute list is supplied, the data is sorted on the first column.

Data file format
----------------

The input data file (the file to be sorted) is a binary file that is structured as follows:

Metadata

4 byte unsigned int:  number of attributes  (n) 
followed by metadata of n attributes, each of the form 
    type (4 bytes), length (4 bytes) 
    Type is one of the following:  1: int, 2: double, 3: char (fixed length) 

Data

Records are fixed length.

Refer to the sort function in sort.c to see how the metadata and data are read from the input binary file

About

An external merge sort implementation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages