Inspiration

As a beginner I always wanted to try out different algorithms and understand what makes them different from each other. Here for this project i got to try out some sorting algorithms and compare them.

What it does

Its as simple as it sounds. Takes in a list and sorts it in ascending order!

How we built it

First I defined a function that takes in an array and return the minimum value of all the elements present in it. Then we iterate through all the elements in the input array, call the minimum function on the array and append it to a new array, remove the minimum element from the original array and continue until we have sorted all of its elements.

arr=list(map(int,input().split()))

newarray=[]

#find minimum element in sub array
def minimum(array):
  mi=array[0]
  for i in range(len(array)):
    if array[i]<mi:mi=array[i]
  return mi

#sort sub arrays and remove minimum element
for i in range(len(arr)):
  min_element=minimum(arr)
  arr.remove(min_element)
  newarray.append(min_element)
print(newarray)

Challenges we ran into

It was challenging to find the right algorithm and implement it the right way.

What's next for Sorting a list

Find and learn more about different sorting algorithms that does the job more efficiently.

Built With

Share this project:

Updates