Skip to content
Advertisement

Insertion Sort Recursion not picking up last element [5,4,3,2,1,0] After sortin [1,2,3,4,5,0] Where last element not sorted

I have been stuck in the middle of the problem I am writing Recursive insertion sort on my own. The program works well but didn’t pick the last element to sort [5,4,3,2,1,0]. After the execution: [1,2,3,4,5,0]

JavaScript

Advertisement

Answer

try this:

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement