Selection Sort 🔥

Run Settings
LanguagePython
Language Version
Run Command
arr = list(map(int,input().split())) def SelectionSort(arr,n): for i in range(n): temp = i+1 m = i while temp < n: if arr[m] > arr[temp]: m = temp temp += 1 arr[i],arr[m] = arr[m],arr[i] return arr print(SelectionSort(arr,len(arr))) ######################################################### # def SelectionSort(l): # # Scan slices l[0:len(l)], l[1:len(l)], ... # for start in range(len(l)): # # Find minimum value in slice . . . # minpos = start # for i in range(start,len(l)): # if l[i] < l[minpos]: # minpos = i # # . . . and move it to start of slice # (l[start],l[minpos]) = (l[minpos],l[start])
Editor Settings
Theme
Key bindings
Full width
Lines