Skip to content
Advertisement

Implementing Insertion sort in Python

I am trying to write the insertion sort algorithm ( without the help of the solution in the book) and so far came up with this algorithm, when I matched it with the solution, it looks different. This is the code I wrote:

JavaScript

Is this code still valid as an insertion sort?

Algo in the book:

JavaScript

Advertisement

Answer

Looks like a bubble sort to me

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