How to stop the selection sort if array is already sorted | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to stop the selection sort if array is already sorted

How do I stop the array or put an bool in the code to break the code if the array is already sorted. Just to make lesser iterations on the code this is my code right now https://code.sololearn.com/cP6Bkr3WFmN5/?ref=app

24th May 2021, 7:58 AM
Gold leaf
1 Answer
+ 2
Hi Miko, The code was truncated cause it's too big to fit in Description. Can you please save that code in SoloLearn and share the link to it instead? Here's how we share link to our code, in case you didn't know ... https://www.sololearn.com/post/75089/?ref=app
24th May 2021, 8:12 AM
Ipang