SelectionSort
This commit is contained in:
9
3. Übungen/16.06.2022/Insertionsort.py
Normal file
9
3. Übungen/16.06.2022/Insertionsort.py
Normal file
@@ -0,0 +1,9 @@
|
||||
data=[9,5,1,4,3]
|
||||
for step in range (1, len(data)):
|
||||
key=data[step]
|
||||
j=step-1
|
||||
while j>=0 and key < data[j]:
|
||||
data[j+1]=data[j]
|
||||
j=j-1
|
||||
data[j+1]=key
|
||||
print(data)
|
||||
Reference in New Issue
Block a user