Skip to content

Commit

Permalink
Fix the insertion sort (trekhleb#86)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
m-maksyutin authored and trekhleb committed Jul 3, 2018
1 parent e3b482c commit d82958d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/algorithms/sorting/insertion-sort/InsertionSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class InsertionSort extends Sort {
// Go and check if previous elements and greater then current one.
// If this is the case then swap that elements.
while (
array[currentIndex - 1] &&
array[currentIndex - 1] !== undefined &&
this.comparator.lessThan(array[currentIndex], array[currentIndex - 1])
) {
// Call visiting callback.
Expand Down

0 comments on commit d82958d

Please sign in to comment.