Skip to content

Instantly share code, notes, and snippets.

@djitz
Created March 15, 2012 13:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djitz/2044203 to your computer and use it in GitHub Desktop.
Save djitz/2044203 to your computer and use it in GitHub Desktop.
Insertion Sort - Pseudocode
//Array
A = {1...n}
//Sort algorithm
for i = 2 to n
j = i
while j > 1
if A[j] < A[j - 1]
swap A[j] and A[j - 1]
j = j - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment