Skip to content

Instantly share code, notes, and snippets.

@Nashtic
Created March 7, 2020 13:08
Show Gist options
  • Save Nashtic/0c9140340a9b6631991cc85478c04624 to your computer and use it in GitHub Desktop.
Save Nashtic/0c9140340a9b6631991cc85478c04624 to your computer and use it in GitHub Desktop.
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