In: Computer Science
In Python, there are different sorting algorithms.
Selection Sort, Bubble Sort and Insertion Sort.
• Write a Pseudo code first for each of these sort methods.
• After writing the pseudo code write python code from the pseudo code.
• Upload the pseudo code and Python code for each of the three algorithm mentioned.
Selection Sort:
CODE:
def selection_Sort(array):
for i in range(len(array)):
midpoint = i
for j in range(i+1, len(array)):
if array[midpoint] > array[j]:
midpoint = j
temp = array[i]
array[i] = array[midpoint]
array[midpoint] = temp
return array
print(selectionSort([99,222,13,1239,10,44,6553,5]))
Bubble sort:
CODE
exp thebubbleSort( array : array of items )
loop = array.count;
for i = 0 to loop-1 do:
swap= false
for j = 0 to loop-1 do:
if larray[j] > arra[j+1] then
swap( [j], array )
swap = true
end if
end for
if(not swap ) then
break
end ifend for
end exp return list
PLEASE GIVE A THUMBS UP DONT GIVE A THUMBS DOWN IF ANY QUERY SO COMMENT DOWN I WILL CLEAR IT FOR YOU !!!!!!