Changes

Jump to navigation Jump to search
323 bytes added ,  19:23, 13 December 2016
no edit summary
Line 40: Line 40:  
insertionSort(alist)
 
insertionSort(alist)
 
print(alist)  
 
print(alist)  
 +
</syntaxhighlight>
 +
 +
Python Insertion Sort Example 2
 +
 +
<syntaxhighlight lang="cpp">
 +
function insertionSort(array A)
 +
    for i from 1 to length[A]-1 do
 +
        value := A[i]
 +
        j := i-1
 +
        while j >= 0 and A[j] > value do
 +
            A[j+1] := A[j]
 +
            j := j-1
 +
        done
 +
        A[j+1] = value
 +
    done
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu