Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d82958d

Browse files
m-maksyutintrekhleb
authored andcommitted
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‎

Lines changed: 1 addition & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /