-
-
Save gomta777/a1c82bdd2a52541a19602ee99a58a7e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def insertionsort(datalist): | |
| for i in range(1, len(datalist)): | |
| insert(datalist, i) | |
| def insert(datalist, i): | |
| temp = datalist[i] | |
| for j in range(i - 1, -1, -1): | |
| if temp < datalist[j]: | |
| datalist[j + 1] = datalist[j] | |
| else: | |
| datalist[j + 1] = temp | |
| break | |
| else: | |
| datalist[0] = temp | |
| # インサーションソートの実装 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment