Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bidirectional conditional insertion sort #68

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
improved tests
Christian Matsoukis committed Jun 14, 2018
commit eff9f84c2abf4a03b0b474dbb0a3b3aeeae112df
Original file line number Diff line number Diff line change
@@ -124,6 +124,7 @@ export default class BCIS extends Sort {
const RC = arr[SR];
do {
const currentItem = arr[i];
this.callbacks.visitingCallback(arr[i]);
if (comp.greaterThan(currentItem, RC)) {
arr[i] = arr[SR - 1];
arr = this.INSRIGHT(arr, currentItem, SR, right, comp);
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@ import {
} from '../../SortTester';

// Complexity constants.
const SORTED_ARRAY_VISITING_COUNT = 0;
const NOT_SORTED_ARRAY_VISITING_COUNT = 0;
const REVERSE_SORTED_ARRAY_VISITING_COUNT = 0;
const EQUAL_ARRAY_VISITING_COUNT = 0;
const SORTED_ARRAY_VISITING_COUNT = 26;
const NOT_SORTED_ARRAY_VISITING_COUNT = 20;
const REVERSE_SORTED_ARRAY_VISITING_COUNT = 26;
const EQUAL_ARRAY_VISITING_COUNT = 90;

describe('BCIS', () => {
it('should sort array', () => {