Sorting Working Python | Sololearn: Learn to code for FREE!


Sorting Working Python

I have tried making sorting the number list, and I dont know, what algorithm is it called because I coded it thinking its algorithm myself. But it doesnt sort the numbers well. It works up to some extent, i.e 30% Any suggestion how to solve it?

3/22/2020 3:28:29 PM

Sarthak 🇳🇵

12 Answers

New Answer


On line 25, replace sort_prev_repeat(sorted_array) with sorted_array = sort_prev_repeat(sorted_array) The algorithm you have implemented here is called "insertion sort", by the way.


maf I don't know. I created my own

+4 Is that what you want ?


Sarthak 🇳🇵 according to which algorithm are you trying to sort the list?


Sarthak 🇳🇵 lol. If u explain me like what is ur desired output, then I would be probavly be able to solve the problem.


Alfred Juma No, I wanted to sort using my own sorting algorithm. maf Sorry, for for less-clarification of code. I'll try to provide you clarification tomorrow in a paper, and here it's time to sleep now.


Schindlabua It got solved both way


John Robotane I know that. I was just trying to understand the algorithm that my brain uses to sort array. And just tried to implement that algorithm in python.


Why not use the built in sort() or sorted()


as Justus said it, it's better to use the built in fonctions, they are more optimized and avoid you headaches!


alright, there is a Sololearn course about sorting:


Sarthak 🇳🇵 alright no prob