Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def kali(a,b):
- result = a * b
- print(f"{a} x {b} = ",result)
- def selectionsort(n,list1):
- i = 0
- for i in range(0,n):
- minIndex = i
- for j in range(i+1,n):
- if list1[minIndex] > list1[j]:
- minIndex = j
- list1[i], list1[minIndex] = list1[minIndex], list1[i]
- def bubblesort(n,list1):
- swap = False
- while not swap:
- swap = True
- for i in range(1,n):
- if list1[i-1] > list1[i]:
- swap = False
- temp = list1[i]
- list1[i] = list1[i-1]
- list1[i-1] = temp
- return list1
- def insertionsort(n,list1):
- for index in range(1,n):
- currentValue = list1[index]
- position = index
- while position > 0 and list1[position - 1] > list1[position]:
- list1[position] = list1[position-1]
- position = position -1
- list1[position] = currentValue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement