Is that Insertionsort?
<p>I really need your help, I am learning sorting-algorithms and i tried to make an Insertionsort-Algorithm. So could you please tell me whether this is an Insertionsort-Algorithm or not?</p>

<pre><code>def insertsort(l):
    for k in range(len(l)):
        for i in range(1,len(l)):
            if l[i]&lt;l[i-1]:
                while l[i]&lt;l[i-1]:
                    l.insert(i-1,l.pop(i))
    return l
</code></pre>

<p>yes, it is insertion sort. The pseudocode is as follows:</p>

<pre><code>1.      for j = 2 to n
2.           key â A [j]
3.          // Insert A[j] into the sorted sequence A[1..j-1]
4.           j â i â 1
5.         while i &gt; 0 and A[i] &gt; key
6.                  A[i+1] â A[i]
7.                  i â i â 1
8.          A[j+1] â key
</code></pre>

python algorithm sorting