Sorts an unsorted numeric array into ascending order using an insertion sort.
var data = [ 4, 9, 2, 6, 3, 1, 7, 10, 5, 8 ] ;
insert( data );
// modifies data into ascending orderTo run the example code from the top-level application directory,
$ node ./examples/index.jsFor 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 |
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 testAll new feature development should have corresponding unit tests to validate correct functionality.
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-covIstanbul creates a ./reports/coverage directory. To access an HTML version of the report,
$ make view-covCopyright © 2014. Rebekah Smith.