0

Sorting

So I just had an idea for a "naive and inefficient" sorting algorithm, that is comparatively simple. The idea is to find the minimum in a list, then to find the next minimum without the previous minimum, then keep doing that until there are no more elements. Then the list is sorted. You would find the minimum by comparing and updating the value of the minimum based on the values in the list. Is there a name for this sorting algorithm? Sorry if this is cringy, but any responses/insights are welcome.

4/4/2021 3:48:26 AM

Edward Finkelstein

+2

This is called Selection Sort .

+4

Edward Finkelstein I believe this would be something like minimal length sorting algorithm.

+4

Edward Finkelstein a simple example of a minimal length sorting algorithm https://code.sololearn.com/c5Y48sU0547Q/?ref=app

+2

Hima, Ah ok, yes I see it is indeed a thing. And to think I felt so special for thinking of it all on my own lol! But it seems like it is actually a viable option in some cases...

+1

Hima, I meant that it is more suited for some cases than for others, not that it doesn't work. It is apparently not as efficient as other algorithms, but it has the advantage of not performing swaps...

0

Edward Finkelstein why only for some cases ? It will always work .