Skip to content

RebekahJ/sort-insertion-asc

Repository files navigation

sort-insertion-asc

Build Status Coverage Status

insert( arr )

Sorts an unsorted numeric array into ascending order using an insertion sort.

Examples

var data = [ 4, 9, 2, 6, 3, 1, 7, 10, 5, 8 ] ;

insert( data ); 
// modifies data into ascending order

To run the example code from the top-level application directory,

$ node ./examples/index.js

Notes

Performance

For an unsorted array of size n, the time to sort the array using insertion sort is:

n Time (ms)
5 9.5
50 10.25
500 12.08
5000 35.25
50000 2274

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

Copyright

Copyright © 2014. Rebekah Smith.

About

Insertion sort for a numeric array.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published