+ 1
Selection Sorting
Can la program of a specific sorting program differ from another program of same sorting technique? I made a program of Selection sorting after knowing its logic but I didn't find any youtube video implementing same program of selection sorting. Though my program is giving correct output, is it correct to be called selection sorting. https://code.sololearn.com/cw4Kpjin2M51/?ref=app
6 Respuestas
+ 3
Yes your code does the selection sort but seems a little more complicated than it needs to be.
You can find other implementations online, including Java, for example here:
https://rosettacode.org/wiki/Sorting_algorithms/Selection_sort#Java
My main recommendation is to choose variable names that better explain their purpose.
Also there are two nested loops in this algorithms. Inside the first loop you make an assumption about the MIN value. You can do a little optimization by assuming the current index as the smallest, and start the inner loop from the next index. After the inner loop you can do a simple swap of the minimum value and the current value.
+ 1
i cant Open your Code can you try to clicke on the plus and add your code
+ 1
implementation of the sorting algorithm can include smaler variations and optimization of the main idea
correct link is
https://code.sololearn.com/cw4Kpjin2M51/?ref=app
+ 1
I am Not very good at Java But i Made it in c++. If it helps i could give you my Code in c++
0
D1M3 i have inserted the code,now you can check it
0
D1M3 no it's ok. I got my all answers, thanks for your efforts