Created
March 7, 2020 13:08
-
-
Save Nashtic/0c9140340a9b6631991cc85478c04624 to your computer and use it in GitHub Desktop.
This file contains 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(arr): """Insertion Sort Fonksiyonu""" | |
n = len(arr) | |
for i in range(1,n): | |
key = arr[i] | |
j = i-1 | |
while j >= and key<arr[j] | |
arr[j+1]=arr[j] | |
j=j-1 | |
arr[j+1]=key | |
def shellSort(arr): """Shell Sort Fonksiyonu""" | |
n=len(arr) | |
gap=n//2 | |
while gap>0: | |
for i in range(gap,n): | |
temp=arr[i] | |
j=i | |
while j>=gap and arr[j-gap]>temp: | |
arr[j]=arr[j-gap] | |
j=j-gap | |
arr[j]=temp | |
gap//=2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment