1.0.5 • Published 7 years ago
merge-sort-array v1.0.5
This is module which can sort an array using merge sort algorithm.
Install.
You can install it from npm repository using next comand:
npm install merge-sort-array --save
This is example how to use this module.
http.createServer(function(request, response) {
var data = '';
request.on('data', function(chunk) {
data += chunk.toString();
});
request.on('end', function() {
var unsortArray = JSON.parse(data);
if (unsortArray.length) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write(JSON.stringify(mergeSort(unsortArray)));
response.end();
}
});
}).listen(3000);