Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d82958d

Browse files
m-maksyutintrekhleb
authored andcommittedJul 3, 2018
Fix the insertion sort (trekhleb#86)
* Fix LinkedList * Fix the prepend method for the LinkedList * Fix the remove method for the MinHeap * Correct a comment * Fix BST removal method * Fix the findEdge method of the graph * Fix the value returned by DisjointSet union * Add recursive factorial function * Fix the insertion sort
1 parent e3b482c commit d82958d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/algorithms/sorting/insertion-sort/InsertionSort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class InsertionSort extends Sort {
1414
// Go and check if previous elements and greater then current one.
1515
// If this is the case then swap that elements.
1616
while (
17-
array[currentIndex - 1] &&
17+
array[currentIndex - 1] !== undefined &&
1818
this.comparator.lessThan(array[currentIndex], array[currentIndex - 1])
1919
) {
2020
// Call visiting callback.

0 commit comments

Comments
 (0)