Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def InsertionSort(Array):
- for arrayPosition in range (1, len(Array)):
- actualElement = Array[arrayPosition] # Elemento que se compara.
- while arrayPosition > 0 and Array[arrayPosition - 1] > actualElement:
- Array[arrayPosition] = Array[arrayPosition - 1]
- arrayPosition -= 1
- Array[arrayPosition] = actualElement
- return Array
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement